[16341] in Perl-Users-Digest
Perl-Users Digest, Issue: 3753 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 20 00:05:32 2000
Date: Wed, 19 Jul 2000 21:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <964065912-v9-i3753@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 19 Jul 2000 Volume: 9 Number: 3753
Today's topics:
Re: @ not piped in print << -> must escape as \@ <shanen@my-deja.com>
[HD] Re: Small job for someone. jvwright@my-deja.com
Re: ATTENTION PERL MEATHEADS (NP)
can i compare refs? kdmasary@my-deja.com
Re: can i compare refs? (Clinton A. Pierce)
Re: Clsid Number Changes <kennylim@techie.com>
Re: Confusion about local() (Abigail)
Re: crypt for Perl 4.0 <bwalton@rochester.rr.com>
directory structure listing <porthos@goplay_nospam.com>
Re: flock <bwalton@rochester.rr.com>
Re: How can I make an .EXE with Perl <bwalton@rochester.rr.com>
Re: How to write data into file ... ? (Keith Calvert Ivey)
Include a script? <chaptera@hotmail.com>
looking for a ODP or yahoo style database <dbowlingNOdbSPAM@iname.com.invalid>
Re: multiline regex (Keith Calvert Ivey)
Re: multiline regex <bwalton@rochester.rr.com>
Re: multiline regex kdmasary@my-deja.com
Re: MySQL+Apache+PHP+mod_perl+mod_ssl - Is it possible? <rdnzl@bucephalus.neo.rr.com>
Re: newbie - like it so far - not so sure I do <bo@bo.com>
Re: newbie - like it so far - not so sure I do (Abigail)
Re: Newbie: Reading in file contents <bo@bo.com>
Re: Newbie: Reading in file contents <dmeyers@panix.com>
Re: Patternmatch and replace values?? <stephenk@cc.gatech.edu>
Re: Patternmatch and replace values?? (Keith Calvert Ivey)
Re: perl rendering html tables - slow <akurczyn@usa.net>
Re: perl-5.6.0: Bug with "not" operator? i_am_leo@my-deja.com
Substr question : what about the fourth argument? <bo@bo.com>
Re: Substr question : what about the fourth argument? (Abigail)
Re: Substr question : what about the fourth argument? <godzilla@stomp.stomp.tokyo>
Re: while (readdir DIR) (Keith Calvert Ivey)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 20 Jul 2000 10:10:57 +0900
From: "Shannon Jacobs" <shanen@my-deja.com>
Subject: Re: @ not piped in print << -> must escape as \@
Message-Id: <8l5p6i$pfc$1@nwms2.odn.ne.jp>
<snip>
> It has nothing to do with the occurrence of the " character in
> your HTML. It has to do with whether the string is being
> interpreted in double-quotish or single-quotish context. If you
> pur double quotes or no quotes around the marker after <<, then
> Perl interpolates scalar and array variables (just as in a
> double-quoted string), so you have to escape all $ and @
> characters that you want included literally; it also interprets
> backslashed sequences like \n for newline. If you put single
> quotes around the marker after <<, then Perl doesn't do that; it
> sounds like that's the solution to your problem.
Thanks very much to the contributors. I think I've been enlightened and
should use the single quote form of here-doc for my purposes.
By the way, in regards to the question in another post of the thread about
TopPage, it's just another one of the WYSIWYG HTML editors.
--
.a/ssig
Misery loves company.
That's why the main product of spamnuts is CDs to make more spamnuts.
Talk about miserable excuses for human beings.
------------------------------
Date: Thu, 20 Jul 2000 02:03:52 GMT
From: jvwright@my-deja.com
Subject: [HD] Re: Small job for someone.
Message-Id: <8l5mm2$n73$1@nnrp1.deja.com>
Hi Danny,
For delegating small jobs like yours, you might consider HotDispatch.
HotDispatch is a marketplace for programmer expertise where questions
often receive responses in less than an hour, and small programming
projects are often completed in less than 24 hours. Prices can be
fixed, negotiable, or by bid. As on auction services such as eBay,
participants who fail to meet their obligations risk their reputations
and their eligibility to participate.
HotDispatch includes an escrow service that takes care of the
accounting, so that you can pay for speedy solutions and tip for
heroic answers, without the overhead of getting physical addresses,
writing out a check, addressing an envelope, and finding a mailbox ---
all the things no one has time for during a time crunch.
HotDispatch: the Market for Technical Expertise
http://www.hotdispatch.com/home?aff=32819422
http://www.hotdispatch.com/search-archives?CATEGORY=42&aff=32819422
http://www.hotdispatch.com/IBM/home?aff=32819422
HotDispatch Corporate Accounts
http://www.hotdispatch.com/about-corporate-accounts.html?aff=32819422
(...to solve problems quickly, offer quick rewards in return...:)
-- jvwright
In article <biQc5.150$wi7.90264@news.pacbell.net>,
"Danny Lipman" <dan@dlna.com> wrote:
> I need a search script edited to only search on one of the fields in
the
> database.
>
> The script workds now based on 9 fields in the database. It's a small
> change I'm sure and it will pay small change. If you are interested
contact
> me.
>
> --
> Sincerely,
>
> Danny Lipman
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 20 Jul 2000 02:13:44 GMT
From: nvp@spamnothanks.speakeasy.org (NP)
Subject: Re: ATTENTION PERL MEATHEADS
Message-Id: <sftd5.349187$MB.5565936@news6.giganews.com>
On 19 Jul 2000 19:00:26 -0700, Randal L. Schwartz <merlyn@stonehenge.com> wrote:
:
: I recognized right off the bat that "perlcoder"'s style was not Kira's
: style. I don't know why it took so long for the others to catch up.
Now for the $64,000,000 question... (I won't dare to ask)
--
Nate II
------------------------------
Date: Thu, 20 Jul 2000 02:11:07 GMT
From: kdmasary@my-deja.com
Subject: can i compare refs?
Message-Id: <8l5n3j$ncb$1@nnrp1.deja.com>
Is it possible to compare references? I know this doesn't work but I'm
trying to do something like it:
if ($reference1 == $reference2) {
do stuff;
}
The references I'm referring to (sorry, couldn't resist ;p) are hard
references to objects.
Thanks,
kevin masaryk
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 20 Jul 2000 03:02:08 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: can i compare refs?
Message-Id: <QYtd5.43887$fR2.403814@news1.rdc1.mi.home.com>
[Posted and mailed]
In article <8l5n3j$ncb$1@nnrp1.deja.com>,
kdmasary@my-deja.com writes:
> Is it possible to compare references? I know this doesn't work but I'm
> trying to do something like it:
>
> if ($reference1 == $reference2) {
> do stuff;
> }
Compare them like this:
if ($reference eq $reference2) {
}
Using a reference like a string won't harm it in this case. This'll
be true if both references point to the same thing..
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours!
clintp@geeksalad.org for details see http://www.geeksalad.org
"If you rush a Miracle Man,
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: Thu, 20 Jul 2000 03:51:37 GMT
From: "Kenny Lim" <kennylim@techie.com>
Subject: Re: Clsid Number Changes
Message-Id: <dHud5.3640$Yy3.132846@newsread2.prod.itd.earthlink.net>
Thanks for the great pointers. The solution provided resolved my problem.
You have a great evening !
Kenny-
"Kenny Lim" <kennylim@techie.com> wrote in message
news:Hl2d5.1780$in.51331@newsread1.prod.itd.earthlink.net...
>
> Hi All,
>
> My objective here is to be able to perform the following task :
>
> To only generate the clsid once, and then manually alter the last 4 digits
> of the first batch of the clsid given. (The 4 digits will be incremented
> sequentially)
> [Please see Example below]
>
> The reason to do this is to help better manage/identify all the clsid id
> given specific to the product versioning.
>
> Example :
>
> (a) Given this clsid number generated from GuidGen.exe
> {ADBE2CC0-5CD5-11D4-85DE-00105AE3A355}
>
> (b) Get the first batch of the clsid which is "ADBE2CC0"
>
> Problem :
>
> (c) Manually increment "2CCO" ensuring that there would be no duplication
> occurs during the generation. (ie. loop 10000 time)
>
> ie. 0001
> ie. 5101 and etc
>
> I was given this theory to resolve the duplicate problem, but this is not
my
> field of expertise
> and I am not sure that I would like to share with you guys.
>
> if N > 8 then my_increment = -1
> else my_increment = 1
>
> Please let me know if you need more explicit information. Thanks All.
>
> Any advise would be greatly appreciated.
>
> Thanks All in advance.
>
> Kenny-
>
>
>
>
------------------------------
Date: 19 Jul 2000 22:09:01 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Confusion about local()
Message-Id: <slrn8ncor3.3do.abigail@alexandra.delanet.com>
Jr. (lmdm@lanl.gov) wrote on MMDXIV September MCMXCIII in
<URL:news:397646C7.C9A9B37F@lanl.gov>:
.. Hey,
..
.. I'd appreciate any insight to this...
..
.. I have the following perl script (followed by output)
..
.. ---begin script---
.. print "\nSet 1:\n";
.. &sub_1( *a );
.. print "5: &main \$a [", $a,"]\n";
.. print "6: &main \$b [", $b,"]\n";
.. print "7: &main \$c [", $c,"]\n";
..
.. print "\nSet 2:\n";
.. &sub_1( *c );
.. print "5: &main \$a [", $a,"]\n";
.. print "6: &main \$b [", $b,"]\n";
.. print "7: &main \$c [", $c,"]\n";
..
.. sub sub_1
.. {
.. local( *b ) = @_;
.. local( $a );
.. $a = "foo";
.. print "1: &sub_1 \$a [",$a,"]\n";
.. print "2: &sub_1 \$b [",$b,"]\n";
.. $b = "hello";
.. print "3: &sub_1 \$a [",$a,"]\n";
.. print "4: &sub_1 \$b [",$b,"]\n";
.. }
.. ---end script---
..
.. ---begin output---
..
.. Set 1:
.. 1: &sub_1 $a [foo]
.. 2: &sub_1 $b [foo]
.. 3: &sub_1 $a [hello]
.. 4: &sub_1 $b [hello]
.. 5: &main $a []
.. 6: &main $b []
.. 7: &main $c []
..
.. Set 2:
.. 1: &sub_1 $a [foo]
.. 2: &sub_1 $b []
.. 3: &sub_1 $a [foo]
.. 4: &sub_1 $b [hello]
.. 5: &main $a []
.. 6: &main $b []
.. 7: &main $c [hello]
..
.. ---end output---
..
.. I am confused as to why line 2 of set 1 has "$b" a value of "foo" when I have
.. changed a "local" variable. Also, why doesn't line 5 of set 1 show "$a" havi
.. a new value of "hello"?
That's because of your juggling with typeglobs. Don't use them unless you
fully understand them. Don't use local if you can use my either. What you
are doing is aliasing *a to *b, and in set 2, you are aliasing *c and *b.
Which means that the *package* variables $a and $b (and later $b and $c)
are the same. Furthermore, local() will not create a local variable -
it will create a local _value_.
Abigail
--
perl -wleprint -eqq-@{[ -eqw\\- -eJust -eanother -ePerl -eHacker -e\\-]}-
------------------------------
Date: Thu, 20 Jul 2000 01:56:36 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: crypt for Perl 4.0
Message-Id: <39765C83.7FC6E9C0@rochester.rr.com>
Keith Calvert Ivey wrote:
>
> Bob Walton <bwalton@rochester.rr.com> wrote:
>
> >At one time, there was a Crypt module, which, if I recall correctly, was
> >an all-Perl implementation of the crypt function (which function was
> >missing from some versions of Perl 4 "due to excessive paranoia"). I no
> >longer have a copy of the Crypt module, and, apparently, neither does
> >CPAN -- after all, crypt is standard in Perl 5. But maybe someone else
> >does?
>
> Actually, some Win32 versions of Perl 5 were the ones with the
> "excessive paranoia" that led to the creation of Crypt.pm.
> That's why it was a module. If it had been for Perl 4, it would
> have been crypt.pl.
>
> --
> Keith C. Ivey <kcivey@cpcug.org>
> Washington, DC
...
Yes, looks like you're right. I did locate a copy of it. It's a bit
long for the newsgroup, so if anyone wants a copy, email to
bwalton@rochester.rr.com . It could probably be adapted for Perl 4
without too much trouble (I barely remember Perl 4 any more).
--
Bob Walton
------------------------------
Date: Wed, 19 Jul 2000 21:12:57 -0700
From: no spam <porthos@goplay_nospam.com>
Subject: directory structure listing
Message-Id: <39767C49.86129786@goplay_nospam.com>
Hi,
I still pretty new to perl but I'm trying to generate a tree listing
that would look something like
top
dir1
dir2
dir2.1
dir3
so far I havent done very well. I made an attempt using find in a shell
script but that didn't work out well
here is what I have so far but its not much.
#!/usr/local/bin/perl
use file::find;
my $dir = "/somewhere"; # directory to start in
sub showit
{
print $dir
}
find(&showit, $dir);
Thanks in advance for all your help
Greg.
------------------------------
Date: Thu, 20 Jul 2000 02:48:23 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: flock
Message-Id: <397668B1.DC769B15@rochester.rr.com>
Jaiganesh Panneerselvam wrote:
>
> I have written a CGI script in PERL for unix to execute a Fortran Program
> from the web. The script receives the input from the user and writes it to a file
> and then executes the fortran program.The fortran program will read the
> data from the file and produces the output.The data stored in the file
> should be protected until fortran program completes the process.Therefore
> I need to Lock the data file when the Fortran program is running.I used
> flock(Exclusive lock) to lock the file but it did not work.The perl book
> says flock may not work in the networks.I need to run the script in the
> AFS network.I am using perl version 5.Is there any another way to solve
> the problem.
...
> Jai
It will all depend on whether you are running an OS that supports
networked file locking. If you are, its documentation on fcntl (man
fcntl) should say so. If it doesn't, you will probably need to switch
to an OS that does. Then you'll need to learn about your system's
fcntl, and then about Perl's fcntl. And don't forget to read all the
FAQ's dealing with file locking (like perldoc -q lock, perlopentut,
etc). Warning: the subject is not trivial.
You might, however, consider another approach: Open a pipe to your
Fortran program in your CGI script, writing the data to the pipe from
Perl and reading the data from the Fortran program's STDIN rather than
from a file. Have the Fortran program generate whatever HTML it needs
to display its output on its STDOUT. Dont' forget to use $|=1; on
Perl's STDOUT before calling your Fortran code via the pipe. I use this
approach with Fortran programs, and it works great. Even on NT.
--
Bob Walton
------------------------------
Date: Thu, 20 Jul 2000 02:36:18 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: How can I make an .EXE with Perl
Message-Id: <397665DC.94D8C579@rochester.rr.com>
jjmi50 wrote:
>
> I am new to Perl.
> I also am new to C++.
> I can make an .EXE in C++.
>
> I know Perl is an Interpreted Language........But I have read
> that if you convert Perl into C language you can make it
> an .EXE.
>
> How do I turn Perl Code into C Code ???
>
> What I have read already doesn't really tell me how to convert
> the Perl source into C source. It just says convert it to C.
...
> Jay
...
Check out:
perldoc perlcompile
http://www.indigostar.com
--
Bob Walton
------------------------------
Date: Thu, 20 Jul 2000 01:55:30 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: How to write data into file ... ?
Message-Id: <397a587f.4681939@news.newsguy.com>
tvn007@my-deja.com wrote:
>Could someone please tell me what I did wrong with the script below ?
You didn't use -w and strict (to let Perl catch errors for you),
and you apparently retyped instead of copying and pasting from
your real code, since the script has at least one typo (on the
substitution line) that prevents it from compiling. Also,
setting $/ to ")" seems a strange choice. It's a waste of time
to analyze the code further because it's not the actual code
you're using.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
(Free at last from the forced spamsig of
Newsfeeds.com, cursed be their name)
------------------------------
Date: Thu, 20 Jul 2000 09:08:58 +0800
From: Tom <chaptera@hotmail.com>
Subject: Include a script?
Message-Id: <39765129.E63BBBA7@hotmail.com>
Dear all,
I have a program that will use the print to generate the html form on
the web.
Like this:
prog1.pl
-----
use CGI;
...
$js=<<END;
<Script language=javascript>
function a()
....
...
function b()
....
END
prog2.pl
-------
use CGI;
...
$js=<<END;
<Script language=javascript>
function a()
....
...
function b()
....
END
prog1.pl & prog2.pl are also using the same javascript function.
If I update the javascript function, it will need to update two
programs.
How can I do that? Can I store the javascript on other files, the call
prog1.pl or prog2.pl to read the file and print on the html forms?
thanks
---
Tom
------------------------------
Date: Wed, 19 Jul 2000 20:42:40 -0700
From: dbowling <dbowlingNOdbSPAM@iname.com.invalid>
Subject: looking for a ODP or yahoo style database
Message-Id: <06284168.83e5f316@usw-ex0109-070.remarq.com>
I am looking to find a perl script (free) for my site that
will function like yahoo or the ODP. It needs submission
forms that I can only use, or that I have to approve. Any
suggestions?
Background info... I am running a joke site and need a way
to organize my listings by catagory and have them
searched... i want easy addition and subtraction and need
to be able to customize the pages
* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
------------------------------
Date: Thu, 20 Jul 2000 01:21:51 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: multiline regex
Message-Id: <397853e1.3499026@news.newsguy.com>
somniculosus <xsNOxsSPAM@korekom.com.invalid> wrote:
>my $line = "<%OUTPUT HERE%>line no. 1\n";
>$line .= "second line of text\n";
>$line .= "last line <%/OUTPUT%>";
>
>my ($format) = ($line =~ m|<%OUTPUT HERE%>(.+)<%/OUTPUT%>|s);
># $format now contains <%OUTPUT HERE%>line no. 1\n
No it doesn't. It contains the other two lines also.
>---
>why doesn't the \s modofier work, to match all the lines up to
>the closing OUTPUT tag?
It does work. What makes you think it doesn't?
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
(Free at last from the forced spamsig of
Newsfeeds.com, cursed be their name)
------------------------------
Date: Thu, 20 Jul 2000 02:30:53 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: multiline regex
Message-Id: <39766493.DD91ECE0@rochester.rr.com>
somniculosus wrote:
...
> my $line = "<%OUTPUT HERE%>line no. 1\n";
> $line .= "second line of text\n";
> $line .= "last line <%/OUTPUT%>";
>
> my ($format) = ($line =~ m|<%OUTPUT HERE%>(.+)<%/OUTPUT%>|s);
> # $format now contains <%OUTPUT HERE%>line no. 1\n
> ---
> why doesn't the \s modofier work, to match all the lines up to
> the closing OUTPUT tag?
...
> Peter
...
When I run your code verbatim, it works fine:
C:\Bob\junk>perl junk177.pl
line no. 1
second line of text
last line
C:\Bob\junk>
code:
my $line = "<%OUTPUT HERE%>line no. 1\n";
$line .= "second line of text\n";
$line .= "last line <%/OUTPUT%>";
my ($format) = ($line =~ m|<%OUTPUT HERE%>(.+)<%/OUTPUT%>|s);
# $format now contains <%OUTPUT HERE%>line no. 1\n
print "$format\n";
--
Bob Walton
------------------------------
Date: Thu, 20 Jul 2000 02:46:46 GMT
From: kdmasary@my-deja.com
Subject: Re: multiline regex
Message-Id: <8l5p6i$ou2$1@nnrp1.deja.com>
Not sure why your code doesn't work. I thought it looked fine so I did a
cut and paste, I didn't change a thing, and it worked correctly. Maybe
it has something to do with your version of perl? I'm using 5.6.0 on
Win32.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 20 Jul 2000 04:01:59 GMT
From: "Nicholas A. Kuzmik" <rdnzl@bucephalus.neo.rr.com>
Subject: Re: MySQL+Apache+PHP+mod_perl+mod_ssl - Is it possible??
Message-Id: <XQud5.2543$u56.32458@typhoon.columbus.rr.com>
In article <8l03b1$ho9$1@nnrp1.deja.com>, vartekquest@my-deja.com wrote:
>
>
> I want to setup a Linux www server with support for PHP + mod_perl +
> SSL, but I haven't been able to compile it succesfully.
>
> - Firstly I install mySQL
> - then I build PHP
> - then I patch apache with mod_ssl
> - then I patch apache with mod_perl
> - from mod_perl I do: make; make install, but it doesn't compile.
> - then I should change httpd.conf to add support for .php, .php3,
> etc. et voila!
>
> The question is: is it possible to share both PHP, mod_perl and
> mod_ssl built on an Apache server? Or is it just plain stupid compiling
> mod_perl when you have PHP?
>
> Has anybody successfully built this config?
>
>
> Sent via Deja.com http://www.deja.com/ Before you buy.
what about php4? if mod_perl is enabled (either by DSO or by built-in), i
get a nasty segfault == document contained no data. bleh...
nick kuzmik
------------------------------
Date: Wed, 19 Jul 2000 22:28:22 -0400
From: "Bo" <bo@bo.com>
Subject: Re: newbie - like it so far - not so sure I do
Message-Id: <8l5nst$g70$1@slb0.atl.mindspring.net>
Ilmari Karonen wrote in message <963986594.21640@itz.pp.sci.fi>...
>In article <8l2vn5$plk$1@slb7.atl.mindspring.net>, Bo wrote:
>>What exactly is "regex" ? I know I could look it up somewhere,
> [snip]
>>but ~ /"(.*?)"/ looks like gibberish even after reading some
>
>Well, there you have one.
>
>Actually, only the "(.*?)" part, quotes included, is the actual
regex.
>The slashes around it tell perl where it starts and ends, and the =~
>operator, which you've chopped in half, applies it to a variable.
>
>Regex stands for regular expression.
Isn't that a misnomer, then? :) I would call it anything but a regular
expression.
>
>A regex essentially describes a pattern. In Perl, and just about
>anywhere else you're likely to see one unless you're a mathematician,
In fact I am! Or was, rather. hehehe.
>they're used specifically to match strings.
>
>The pattern you quoted, for example, matches two double quotes and
the
>least possible number of characters in between.
> Actually, that's not
>quite true - it matches the first double quote it can find, and then
>as many characters as necessary to reach the next one. If it can do
>that, it also captures anything between the quotes for later use.
This now makes it sound like a different thing altogether.
>
>How did I know that? By having read a regular expression tutorial,
>and remembering what all the special characters mean. The dot in
that
>regexp, for example, matches any character. Well, except an newline,
>but that can be changed by a modifier. The asterisk after it makes
>the previous pattern - the dot, that is - match zero or more times,
>instead of just once, and the question mark after it makes it prefer
>short matches over longer ones. (The question is not just a special
>character, it has quite a few _different_ special meanings depending
>on what comes before it.)
>
For simplicity's sakes! Yikes! ;-)
>The parentheses tell the regex engine to capture anything matched by
>the patterns between them for later use. They also serve another
>purpose of grouping their contents into a single pattern, which could
>be repeated using * for example, but that's not used in this case.
>
>The quotes are just literal quotes, and match themselves.
>
>
>One could write entire books about regular expressions. Fortunately
I
>don't have to, since others have already done that. You could find
>one at a local bookstore or library, or you could do a web search for
>something like "regular expression tutorial".
>
>Once you know what regular expressions are, you should get familiar
>with the Perl regex dialect. Some of those tutorials are already
>geared towards Perl, but the definitive guide is the perlre manpage.
>The easiest way to access it, assuming you have perl installed, is to
>type "perldoc perlre" at your shell prompt. Windows users who have
>ActiveState perl can also find the documentation in their Start menu,
>and those with no perl at all can find it at http://www.perl.com/.
>
>--
>Ilmari Karonen - http://www.sci.fi/~iltzu/
>"The screwdriver *is* the portable method." -- Abigail
>Please ignore Godzilla and its pseudonyms - do not feed the troll.
Thanks for your very kind (and also detailed) answer, Ilmari. (The
name is Finnish, isn't it, but the English is good! ;0)
>
>
------------------------------
Date: 19 Jul 2000 22:54:12 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: newbie - like it so far - not so sure I do
Message-Id: <slrn8ncrfp.3do.abigail@alexandra.delanet.com>
Bo (bo@bo.com) wrote on MMDXV September MCMXCIII in
<URL:news:8l5nst$g70$1@slb0.atl.mindspring.net>:
@@ Ilmari Karonen wrote in message <963986594.21640@itz.pp.sci.fi>...
@@ >
@@ >Regex stands for regular expression.
@@
@@ Isn't that a misnomer, then? :) I would call it anything but a regular
@@ expression.
And you might call 'blue' anything but blue, but that doesn't help
you much. The rest of the world does.
@@ >A regex essentially describes a pattern. In Perl, and just about
@@ >anywhere else you're likely to see one unless you're a mathematician,
@@
@@ In fact I am! Or was, rather. hehehe.
The field of regular expression theory was pioneered by mathematicians.
Abigail
--
perl -wlne '}print$.;{' file # Count the number of lines.
------------------------------
Date: Wed, 19 Jul 2000 22:37:04 -0400
From: "Bo" <bo@bo.com>
Subject: Re: Newbie: Reading in file contents
Message-Id: <8l5od8$j91$1@nntp9.atl.mindspring.net>
>
>> >open (JOBS, "jobs.dat");
>> >while($line = <JOBS>)
>> >{ print $line; }
>
>> Question : how are you advancing thru this loop?
>> How is $line "incremented" ?
>
>Read the docs. Or , pick up a copy of Learning Perl,
>published by O'Reilly. This is _very_ basic Perl.
>
>As far as the above code, that open should check
>for success (ie. open (...) or die "error message:$!";)
>
>and the reading in of the file, line by line, is via
>the angle-brackets: <JOBS>
>
>Seriously, though, while this may answer your question,
>it's nowhere near enough. Read Learning Perl.
Please forgive me for asking these questions, but I hate not
understanding the simple stuff after i've been reading some perl docs,
and I even got Castro's Perl and CGI fot the WWW. I've only been doing
it for a few days though, and I haven't absorbed all the basics yet.
Are you aware of any Q&A tutorials on the web, to supplement book
learning? I tend to learn much faster when someone can answer my
direct questions, although book reading is also mandatory, of course.
Thanks, Bo.
>
>--d
------------------------------
Date: 19 Jul 2000 23:28:55 -0400
From: David Meyers <dmeyers@panix.com>
Subject: Re: Newbie: Reading in file contents
Message-Id: <yob8zuxfpjc.fsf@panix2.panix.com>
"Bo" <bo@bo.com> writes:
[said i:]
> >Read the docs. Or , pick up a copy of Learning Perl,
> >published by O'Reilly. This is _very_ basic Perl.
> Please forgive me for asking these questions, but I hate not
> understanding the simple stuff after i've been reading some perl docs,
> and I even got Castro's Perl and CGI fot the WWW. I've only been doing
> it for a few days though, and I haven't absorbed all the basics yet.
If your docs didn't cover the open command and the angle brackets <>
for reading said file, your docs really are pretty basically
incomplete if not entirely absurd.
> Are you aware of any Q&A tutorials on the web, to supplement book
> learning? I tend to learn much faster when someone can answer my
> direct questions, although book reading is also mandatory, of course.
Again, I'll direct you to the book Learning Perl by Randall Schwartz,
published by O'Reilly. It's structured as a tutorial and covers
the basics. Moreover, you have pretty complete documentation on
your system which came with your perl if it's any of the standard
distributions. If it's not, get one. And hunt through the
various Perl related websites, start with http://www.perl.com
--d
------------------------------
Date: Wed, 19 Jul 2000 21:42:43 -0400
From: Stephen Kloder <stephenk@cc.gatech.edu>
Subject: Re: Patternmatch and replace values??
Message-Id: <39765912.FA14DD35@cc.gatech.edu>
John Casey wrote:
> create unique index TABLE_IDX on TABLE_G(DD) storage (initial 30 k next 35 k pctincrease 10) tablespace idxts
Notice no space between the 10 and ')'
>
> s/storage\s+\(initial\s+(\d+)\sk\s+next\s+(\d+)\sk\s+pctincrease\s+(\d+)\s+\)/storage\s+\(initial\s+\Q$initial_new\sk\s+next\s+\Q$next_new\sk\s+pctincrease\s\Q$pctincrease_new\)/
And here you use 'pctincrease\s+(\d+)\s+\)', which will not match until you remove the \s+ (or replace it with \s*).
I recommend you break up long regexes like that to verify that each part works before assembling them into one messy regex.
--
Stephen Kloder | "I say what it occurs to me to say.
stephenk@cc.gatech.edu | More I cannot say."
Phone 404-874-6584 | -- The Man in the Shack
ICQ #65153895 | be :- think.
------------------------------
Date: Thu, 20 Jul 2000 01:35:37 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Patternmatch and replace values??
Message-Id: <3979546d.3639167@news.newsguy.com>
John Casey <John_member@newsguy.com> wrote:
>***
>create unique index TABLE_IDX on TABLE_G(DD) storage (initial 30 k next 35 k
>pctincrease 10) tablespace idxts
>****
>
> and replace the values after initial (30 k), next (35 k), pctincrease (10)
>with values from variables $initial_new, $next_new and $pctincrease_new
>respectively.
>
> I tried ,
>$line =~
>s/storage\s+\(initial\s+(\d+)\sk\s+next\s+(\d+)\sk\s+pctincrease\s+(\d+)\s+\)/storage\s+\(initial\s+\Q$initial_new\sk\s+next\s+\Q$next_new\sk\s+pctincrease\s\Q$pctincrease_new\)/
>
> (whew!)... but it does not work.
There's no whitespace before the closing parenthesis in your
data, so the regex doesn't match.
Using paired delimiters and the /x modifier for your
substitution would make it a little more readable:
s{ storage\s+\(
initial \s+(\d+)\sk\s+
next \s+(\d+)\sk\s+
pctincrease\s+(\d+)
\)
}
{storage (initial $initial_new k next $next_new k
pctincrease $pctincrease_new)}x
Note that the last part of your substitution is a regular
double-quoted string, not a regex, so you don't want \s and +
and \Q in it (and you have to turn \Q off with \E when you do
use it).
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
(Free at last from the forced spamsig of
Newsfeeds.com, cursed be their name)
------------------------------
Date: Wed, 19 Jul 2000 21:54:13 -0500
From: "Alejandro Kurczyn" <akurczyn@usa.net>
Subject: Re: perl rendering html tables - slow
Message-Id: <397670b4_1@excalibur.gbmtech.net>
"Mark Worsdall" <linux@worsdall.demon.co.uk> escribió en el mensaje
news:juYkMWA3pjd5EwiT@worsdall.demon.co.uk...
> Hi,
>
> I am rendering an html table from a data file, this csv file is 67K in
I believe there is a way to start the table display before the whole HTML
file is received by the browser, check
http://msdn.microsoft.com/workshop/author/tables/BuildTables.asp for more
pointers, but remember that site speaks mainly IE. Another source of
information is www.w3.org and last but not least, check the HTMLib, a very
handy HTML/CSS reference with static/dynamic table samples (this one runs on
Windows).
Finally, remember that the smaller the file, the faster it travels. As far
as I remember, you can get rid of all the </TD>, and </TR> closing tags
since they are no longer needed.
This is not perl related, but I'm posting to the group in case someone is
working on Perl & HTML. I find those references very useful for that.
regards,
Alejandro
------------------------------
Date: Thu, 20 Jul 2000 01:27:38 GMT
From: i_am_leo@my-deja.com
Subject: Re: perl-5.6.0: Bug with "not" operator?
Message-Id: <8l5khu$loa$1@nnrp1.deja.com>
hakon.alstadheim@oslo.mail.telia.com wrote:
> Earlier mike@excite.com wrote:
> > Earlier yet, Rafael Garcia-Suarez <rgarciasuarez@free.fr> wrote:
> > >I think this change was made to make constructs like
> > > not($a) || $b
> > >more intuitive.
> >
> > In that case, you should have used:
> > ! $a || $b
> > or
> > (not $a) || $b
> >
> [...]
> > The more I think about it, the less I like this change.
>
> Precisely my thoughts. We need to find out the rationale behind this.
> [...]
Alternatively, anyone who likes to use names,
just for the sake of using names, should use
names for ALL the operators, like this:
not ($a) or $b
that works the same in both old and new perl.
The problem is that these two expressions:
not ($a) or $b
not ($a) || $b
were different in the in the old perl
but they are the same now.
By the way, if perl5.6.0 always uses the concept
"if it looks like a function, it is a function",
then why don't these two expressions give the
same value for $a:
$a = (1 || (0) , 2)
$a = (1 or (0) , 2)
-Leo
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 19 Jul 2000 22:41:08 -0400
From: "Bo" <bo@bo.com>
Subject: Substr question : what about the fourth argument?
Message-Id: <8l5okq$k8r$1@nntp9.atl.mindspring.net>
What does the fourth argument of the substr function do?
Some docs don't mention it, while others do.
Can anyone give an example?
Thank you very much.
------------------------------
Date: 19 Jul 2000 22:51:12 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Substr question : what about the fourth argument?
Message-Id: <slrn8ncra5.3do.abigail@alexandra.delanet.com>
Bo (bo@bo.com) wrote on MMDXV September MCMXCIII in
<URL:news:8l5okq$k8r$1@nntp9.atl.mindspring.net>:
\\ What does the fourth argument of the substr function do?
\\ Some docs don't mention it, while others do.
Which docs that should mention it don't mention it?
The manual explains.
Abigail
--
package Z;use overload'""'=>sub{$b++?Hacker:Another};
sub TIESCALAR{bless\my$y=>Z}sub FETCH{$a++?Perl:Just}
$,=$";my$x=tie+my$y=>Z;print$y,$x,$y,$x,"\n";#Abigail
------------------------------
Date: Wed, 19 Jul 2000 20:50:01 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Substr question : what about the fourth argument?
Message-Id: <397676E9.B46CB4EA@stomp.stomp.tokyo>
Bo wrote:
> What does the fourth argument of the substr function do?
> Some docs don't mention it, while others do.
> Can anyone give an example?
There are times testing an unknown will yield
an answer right off. This is how most of us,
as children, learn not to stick our fingers
into this fascinating stuff we call fire.
Fourth function is a modern day White-Out for typists.
TEST SCRIPT:
____________
#!/usr/local/bin/perl
print "Content-Type: text/plain\n\n";
$string = "Godzilla ooppsie Rolls";
print "Input: $string\n\n";
$new_string = substr ($string, 9, 7, "Rocks And");
print "Output: $string \n\nReturned To New String: $new_string";
exit;
PRINTED RESULTS:
________________
Input: Godzilla ooppsie Rolls
Output: Godzilla Rocks And Rolls
Returned To New String: ooppsie
Godzilla!
--
print "http://mailto:%63%61ll%67i%72l@3483852801/%7e%63%61ll%67i%72l";
------------------------------
Date: Thu, 20 Jul 2000 00:58:43 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: while (readdir DIR)
Message-Id: <39764e11.2010701@news.newsguy.com>
Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>On Wed, 19 Jul 2000 11:14:13 -0400, Jeff Boes Wrote:
>> while(scalar(readdir DIR))...
>>
>> and I just don't get it.) What's different about 'readdir DIR' and
>> '<FILE>'?
>
>Because it is the diamond operator that is special here not the while().
It's the diamond operator in combination with the while() that's
special. Neither is special on its own. A plain
<FILE>;
doesn't assign to $_ (or test for definedness, though that
wouldn't make sense there anyway).
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
(Free at last from the forced spamsig of
Newsfeeds.com, cursed be their name)
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3753
**************************************