[8217] in Perl-Users-Digest
Perl-Users Digest, Issue: 1835 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 9 03:07:47 1998
Date: Mon, 9 Feb 98 00:00:40 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 9 Feb 1998 Volume: 8 Number: 1835
Today's topics:
"Mastering Regular Expressions" (David Oswald)
Re: "Mastering Regular Expressions" <ldanna@hotmail.com>
Re: Basic question (123) (Martien Verbruggen)
Re: Basic question (123) <rjk@coos.dartmouth.edu>
Control a serial device with Perl <Wolbeck@WriteMe.com>
Re: Create new file on NT50? <kenny@weng.dk>
Re: Destroying any and all elments of an array.. how? (Greg Andrews)
Re: foreach and my() <rjk@coos.dartmouth.edu>
Re: Fork is cheap and powerful <ldanna@hotmail.com>
How to get a listing of the file that is linked? bz7347275@ntu.edu.sg
Re: Installing Linux and Perl? <dformosa@st.nepean.uws.edu.au>
Re: Is Perl 5 year 2000 compliant? <dformosa@st.nepean.uws.edu.au>
Re: MacPerl_not_even_newbie (Martien Verbruggen)
Re: More regular expressions <scottj@mthcsc.wfu.edu>
Re: More regular expressions (Michael Fuhr)
Re: More regular expressions <*@qz.to>
Re: More regular expressions (Martin Vorlaender)
Re: More regular expressions <rjk@coos.dartmouth.edu>
Re: More regular expressions (Craig Berry)
Re: More regular expressions (Craig Berry)
Re: New Perl book reviews <ldanna@hotmail.com>
Re: Perl documentation (was re: Perl Year 2000 ...) <bcoleman@mindspring.com>
Re: Perl in a datawarehouse environment (Jonathan Feinberg)
Re: Perl Win32 and Require's (David Stack)
Re: Regex From Hell? <*@qz.to>
Re: Regular expression expander <*@qz.to>
Re: regular expressions <*@qz.to>
Re: regular expressions (Martin Vorlaender)
Re: regular expressions <rjk@coos.dartmouth.edu>
Re: Sharing variables between scripts <ldanna@hotmail.com>
Re: Strings, numbers, and hash <rjk@coos.dartmouth.edu>
Re: Syntax-coloring editor for NT <ldanna@hotmail.com>
Re: Year 2000 Compliance: Lawyers, Liars, and Perl (Bill Clark)
Re: Year 2000 Compliance: Lawyers, Liars, and Perl <Barticus@worldnet.att.spam.net>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 09 Feb 1998 06:06:09 GMT
From: doswald@xmission.com (David Oswald)
Subject: "Mastering Regular Expressions"
Message-Id: <34de9a1f.28410048@news.xmission.com>
In my continual quest to maximize my skills so that I may more fully
exercise laziness I'm interested in another book that will help me to
improve my effectiveness toward those goals. I've been interested in
ordering either "Mastering Regular Expressions" (O'Reilly & Assoc) or
"Advanced Perl Programming" (O'Reilly & Assoc). There are no
bookstores in my area that have either of these books, so I can't
really look them over before buying. Thus I turn here for a
recommendation.
'Advanced' sounds very interesting to me, but I read another post here
mentioning that it is rather error-ridden. I'd be surprised if this
is true, coming from a publisher like O'Reilly, but I would rather not
buy it and find out that it is indeed troublsome. Would this
respected Usenet community recommend 'Advanced'?
The other publication that has my interest is the "Mastering Regular
expressions" book. Again, I can't find anyone local who has one
sitting on the shelf. It sounds interesting to me but I'd like to
hear firsthand that it's a good book. I can always order it, but some
recommendations first would be greatly appreciated.
I apologize for bringing up the book question again. I've read the
reviews on O'Reilly's site, but it's always nice to hear from some of
the satisfied (or not so) customers.
By the way, for those who are considering other Perl titles, I can
personally strongly recommend Learning Perl and Programming Perl (the
Llama and Camel books) as well as the somewhat perl oriented Mouse
book (Programming CGI).
Thanks,
Dave
------------------------------
Date: Mon, 09 Feb 1998 02:32:37 -0500
From: Larry D'Anna <ldanna@hotmail.com>
Subject: Re: "Mastering Regular Expressions"
Message-Id: <34DEB115.11CD7957@hotmail.com>
David Oswald wrote:
>
> In my continual quest to maximize my skills so that I may more fully
> exercise laziness I'm interested in another book that will help me to
> improve my effectiveness toward those goals. I've been interested in
> ordering either "Mastering Regular Expressions" (O'Reilly & Assoc) or
> "Advanced Perl Programming" (O'Reilly & Assoc). There are no
> bookstores in my area that have either of these books, so I can't
> really look them over before buying. Thus I turn here for a
> recommendation.
>
> 'Advanced' sounds very interesting to me, but I read another post here
> mentioning that it is rather error-ridden. I'd be surprised if this
> is true, coming from a publisher like O'Reilly, but I would rather not
> buy it and find out that it is indeed troublsome. Would this
> respected Usenet community recommend 'Advanced'?
>
> The other publication that has my interest is the "Mastering Regular
> expressions" book. Again, I can't find anyone local who has one
> sitting on the shelf. It sounds interesting to me but I'd like to
> hear firsthand that it's a good book. I can always order it, but some
> recommendations first would be greatly appreciated.
>
> I apologize for bringing up the book question again. I've read the
> reviews on O'Reilly's site, but it's always nice to hear from some of
> the satisfied (or not so) customers.
>
> By the way, for those who are considering other Perl titles, I can
> personally strongly recommend Learning Perl and Programming Perl (the
> Llama and Camel books) as well as the somewhat perl oriented Mouse
> book (Programming CGI).
>
> Thanks,
>
> Dave
They are both great books, just what you would expect from O'Reilly.
I don't know if all those errors are present "Advanced Perl Programing" but
I have found it to be quite useful.
---------------------------------------------------
|Democracy is the worst system of government. --
|Except for all the others
| -Winston Churchill
---------------------------------------------------
Larry D'Anna "eschew obfuscation"
------------------------------
Date: 9 Feb 1998 04:01:37 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Basic question (123)
Message-Id: <6blv31$bsm$1@comdyn.comdyn.com.au>
In article <Pine.SUN.3.96.980208163814.24167A-100000@coyote.rain.org>,
Nick Halloway <snowe@rain.org> writes:
> The standard input goes to $_, right -- but saying
Does it?
perldoc perlvar
The entry for $_ doesn't mention that. :)
Maybe you're thinking of things like
while (<STDIN>)
{
# Here every line of STDIN is available in $_
}
or even
while (<>)
{
}
Although that is slightly different, because in this case, input will
be read from either standard input, or each file listed as an
argument. (perldoc perlop, look for <>)
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Inside every anarchy lurks an old boy
Commercial Dynamics Pty. Ltd. | network - Mitchell Kapor
NSW, Australia |
------------------------------
Date: Mon, 09 Feb 1998 01:57:57 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
To: Nick Halloway <snowe@rain.org>
Subject: Re: Basic question (123)
Message-Id: <34DEA8F8.68D0A6EC@coos.dartmouth.edu>
[posted and mailed]
Nick Halloway wrote:
>
> The standard input goes to $_, right
No, the standard input goes to whereever you put it. Many
operations, including the input operator <>, default to
using $_. -p and -n also put input in $_. But, if you don't
read in the input somehow, it won't get put anywhere.
Could that be your problem?
You may need to provide more details about your script.
Chipmunk
------------------------------
Date: 9 Feb 1998 07:16:08 GMT
From: "Muriel & Dirk O. Wolbeck" <Wolbeck@WriteMe.com>
Subject: Control a serial device with Perl
Message-Id: <01bd3506$ccc39e90$1464a8c0@honey>
I want control a serial device (connected to my Linux box) with Perl. I
heard that all I have to do is to open the device as a file and use write
and read operations to access the serial device like a modem.
I tried it without success.
What I have to do ?
Could anybody mail me an example ?
Thanks
-- Dirk Wolbeck
,,, e-mail: dirk@wolbeck.de
(o o) Internet: http://www.wolbeck.de
--oOO--(_)--OOo-------------------------------------------------
------------------------------
Date: Mon, 9 Feb 1998 08:08:37 +0100
From: <kenny@weng.dk>
Subject: Re: Create new file on NT50?
Message-Id: <6bma26$fvl$1@news1.inet.tele.dk>
Sure.. Here is what I want to do. I want to create a new file with a simple
free homepage system.
The user fills in the form with a name for his html-file and then the script
creates a html-file for
that user:
Now the question is: Why does the script die when it tries to create the
html-file thatn do not exist?
---c--
$htmlfile = $FORM{'pagefile'};
open(HTMLFILE,">$htmlfile") || die "Oppps, maybe there is more to write
accress than I thought\n";
---c--
If the file exists than there is no problem, but I really have a problem
knowing what the filename will be for that
user :)
I'am using NT40 (sorry about the subject) with IIS30. Read and write is set
for my directories. The problem is also
that i'm not located in front of the server right now.
------------------------------
Date: Mon, 9 Feb 1998 06:03:25 GMT
From: gerg@netcom.com (Greg Andrews)
Subject: Re: Destroying any and all elments of an array.. how?
Message-Id: <gergEo3Ktp.317@netcom.com>
dilcher@cueva.nospam.com (Jeff) writes:
>
>Can someone tell me the most efficient way to destroy any and all
>elements that are contained within an array? This seems like it
>should be a simple matter, but I don't have an idea of how to do this.
>
Looks like everyone has told you how to delete all elements of
an array, but not how to delete any elements. That is, how to
delete just one element, shrinking the array.
If the element to be deleted is the lowest- or highest-indexed,
you can use shift, pop, or splice to remove the element. (shift
and pop are usually easier to understand)
If the element is in the middle of the array, use splice to
delete it. Splice can delete multiple elements if you want it
to, which would be more efficient than calling shift or pop
multiple times.
Hope this helps,
-Greg
--
::::::::::::::::::: Greg Andrews gerg@netcom.com :::::::::::::::::::
Conway's Law: In any organization there will always be
one person who knows what is going on.
This person must be fired.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
------------------------------
Date: Mon, 09 Feb 1998 01:36:20 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: foreach and my()
Message-Id: <34DEA3E5.84D935C5@coos.dartmouth.edu>
Denis Goddard wrote:
>
> Chipmunk wrote:
>
> > I'm a little confused by these two bits of code:
>
> [snipped]
>
> > Even though $a has been declared with my() in the second example, it
> > should still be lexically scoped to the package level. I don't understand
> > why it becomes lexically scoped to the foreach loop.
>
> Well, from what you quote in the manpage, it seems like it's doing just what it says
> it will.Specifically:
>
> > The perlsyn manpage reads:
> > ...If the variable was previously declared
> > with my, it uses that variable instead of the global one, but it's still
> > localized to the loop.
I'm probably confusing "localized to the loop" with the implementation of local().
Nevertheless, if the implementation is according to the documentation, which it
most likely is, the question still remains, why is it implemented that way?
In particular, since this is legal syntax:
foreach my $a (@list) {
}
It makes no sense for this to have the same effect:
my($a);
foreach $a (@list) {
}
Consider the following code:
~> perl
@list = (1 .. 3);
my($a);
print "while\n";
while (defined($a = shift @list)) {
print "$a\n";
&foo();
}
print "for\n";
for ($a=1;$a<=3;++$a) {
print "$a\n";
&foo();
}
print "foreach\n";
foreach $a (1 .. 3) {
print "$a\n";
&foo();
}
sub foo {
print "$a\n";
}
__END__
while
1
1
2
2
3
3
for
1
1
2
2
3
3
foreach
1
4
2
4
3
4
Unlike the first two, which leave $a scoped to the package level,
foreach has $a lexically scoped to the foreach loop.
Chipmunk
------------------------------
Date: Mon, 09 Feb 1998 01:41:43 -0500
From: Larry D'Anna <ldanna@hotmail.com>
Subject: Re: Fork is cheap and powerful
Message-Id: <34DEA527.CDE1F3DA@hotmail.com>
Tom Christiansen wrote:
>
> Contrary to what prisoners of a lesser operating system will tell you,
> fork is a elegant and inexpensive solution to many multitasking needs.
> Be not deceived!
>
> The following example shows the effect of forking large perl processes
> on your vmsytem. For example, here is the first 6 lines of output
> (the second argument is the head -N param) of running 2**7 processes
> (seven being the number of forks.)
>
> chthon(tchrist)% perl /tmp/chkfork 7 6
> 7128 Cached 21M 21M 21M 21M 21M 21M 21M
> 7128 MemFree 42M 41M 41M 41M 40M 39M 36M
> 7128 MemTotal 124M 124M 124M 124M 124M 124M 124M
> 7128 SwapFree 251M 251M 251M 251M 251M 251M 251M
> 7128 Buffers 24M 24M 24M 24M 24M 24M 24M
> 7128 MemShared 48M 55M 61M 78M 113M 181M 290M
>
Wow!
How does the kernel do that?
---------------------------------------------------
|Democracy is the worst system of government. --
|Except for all the others
| -Winston Churchill
---------------------------------------------------
Larry D'Anna "eschew obfuscation"
------------------------------
Date: Mon, 09 Feb 1998 15:42:38 -0800
From: bz7347275@ntu.edu.sg
Subject: How to get a listing of the file that is linked?
Message-Id: <34DF946D.CCB74EB2@iris.eee.ntu.edu.sg>
Hi,
I would like to know the time stamp of a file, but if it is
symlinked, i got to cd to that
directory to check on that file.
How can i script perl in the way to check for the sym link then get
the real time stamp
from the file?
eg :
lrwxr-xr-x 1 root sys 17 Dec 13 1994 /usr/bin/foo ->
../lib/free/bar #linked file
-rwxr-xr-x 1 root sys 65 Dec 19 10:45 /usr/lib/free/bar
Desired result :
filename : /usr/lib/free/bar
date : Dec 19
Time : 10:45
mode : -rwxr-xr-x
Benny
benny@iris.eee.ntu.edu.sg
PS : would be happy if replies thru my email as well as thru the
newsgroup
------------------------------
Date: 9 Feb 1998 06:57:35 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: Installing Linux and Perl?
Message-Id: <887007415.580745@cabal>
In <886897766.456654854@dejanews.com> David Hasbrouck <davidh@wwwpromote.com> writes:
>I am looking to install Linux and Perl on my own pc so I am able to test
>and debug Perl code before uploading to the server.
>I guess my question is, can this be done?
Yes, perl works perfictly well under linux.
--
Please excuse my spelling as I suffer from agraphia see the url in my header.
Never trust a country with more peaple then sheep.
Support NoCeM http://www.cm.org/
I'm sorry but I just don't consider 'because its yucky' a convincing argument
------------------------------
Date: 9 Feb 1998 07:01:00 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: Is Perl 5 year 2000 compliant?
Message-Id: <887007621.478265@cabal>
In <Pine.GSO.3.96.980208131148.15943X-100000@user2.teleport.com> Tom Phoenix <rootbeer@teleport.com> writes:
>On Thu, 5 Feb 1998, Tiberius wrote:
>> > RTFM...
>>
>> Why do perl-ers so often insist on posting this worthless response,
>Because it's not worthless. When the answer is in TFM, it's right to say
>RTFM.
The problem is that when multipal peaple give RTFM replies it gets some
what repeadative. A suggestion if you make a RTFM type reply why don't
you set the message id to <rtfm.orginal-message-id> so only one reply will
ever occour on the same newspool.
--
Please excuse my spelling as I suffer from agraphia see the url in my header.
Never trust a country with more peaple then sheep.
Support NoCeM http://www.cm.org/
I'm sorry but I just don't consider 'because its yucky' a convincing argument
------------------------------
Date: 9 Feb 1998 04:05:44 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: MacPerl_not_even_newbie
Message-Id: <6blvao$bsm$2@comdyn.comdyn.com.au>
In article <19980209032301.WAA24241@ladder02.news.aol.com>,
ddarras@aol.com (Ddarras) writes:
> realized that it was double quotations, not single quotations that I needed to
> use...back to this online tutorial at the waite group ezone..any other simple
> macperl differences I would be well advised to consider?
Differences? There shouldn't be any differences in the way perl works
at that level. Double quotes and single quotes mean something
different to perl in all versions.
Of course, there are bound to be things different in perl for the Mac,
perl for NT and perl for Unix. Those differences should be covered in
the documentation though... Aren't they? These differences are not
differences on the syntax level though, but merely in the way some
things are implemented.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Make it idiot proof and someone will
Commercial Dynamics Pty. Ltd. | make a better idiot.
NSW, Australia |
------------------------------
Date: Sun, 08 Feb 1998 22:32:55 -0500
From: Kevin Scott <scottj@mthcsc.wfu.edu>
Subject: Re: More regular expressions
Message-Id: <34DE78E7.D8A4675@mthcsc.wfu.edu>
Mike Binkley wrote:
[snip]
> In a nutshell, I'm looping through a string. One time I'm going to loop
> through it and look for a := using a simple
> $word =~ s/:=/ := /
> (or whatever the exact syntax of it is)
> This just puts a space on each side of the :=
>
> But then later, I'm going to need to loop through the same string and look
> for a =
> but using
> $word =~ s/=/ = /
> will also space out the = that is part of the := expression so I would end
> up with
> : =
> instead of
> =
>
> Is there a way that I can search for the string (=), but do nothing if it
> is part of the larger string (:=)?
[snip]
Doesn't
$word =~ s/(:=|=)/ $1 /g;
do what you want?
--
****** Kevin Scott
******* Department of Mathematics & Computer Science
******** Wake Forest University
******* scottj@mthcsc.wfu.edu
------------------------------
Date: 8 Feb 1998 21:15:32 -0700
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: More regular expressions
Message-Id: <6blvt4$hsd@flatland.dimensional.com>
ThomaJA@LFC.EDU (Mike Binkley) writes:
> Is there a way that I can search for the string (=), but do nothing if it
> is part of the larger string (:=)?
Take a look at the perlre manual page and read the section about
negative lookahead assertions. Pay particular attention to what it
says about lookbehind assertions, since that's what you're
doing (looking for an "=" that isn't preceded by ":").
Hope this helps.
--
Michael Fuhr
http://www.dimensional.com/~mfuhr/
------------------------------
Date: 9 Feb 1998 05:06:31 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: More regular expressions
Message-Id: <qz$9802082353@qz.little-neck.ny.us>
Mike Binkley <ThomaJA@LFC.EDU> wrote:
> Is there an easy way to perform operations on strings and then on substrings?
Not exactly easy, but not too hard.
> $word =~ s/:=/ := /
> But then later, I'm going to need to loop through the same string and look
> for a = but using
> $word =~ s/=/ = /
> Is there a way that I can search for the string (=), but do nothing if it
> is part of the larger string (:=)?
$word =~ s/(:?=)/ $1 /;
Is the absolute easiest way for this example. For a more general case
try something like:
$word =~ s/(^|[^:])=/$1 = /;
Elijah
------
is negative look behind going to be in 5.005?
------------------------------
Date: Mon, 09 Feb 1998 05:43:08 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: More regular expressions
Message-Id: <34de895c.524144494f47414741@radiogaga.harz.de>
Mike Binkley (ThomaJA@LFC.EDU) wrote:
: In a nutshell, I'm looping through a string. One time I'm going to loop
: through it and look for a := using a simple
: $word =~ s/:=/ := /
: (or whatever the exact syntax of it is)
: This just puts a space on each side of the :=
: But then later, I'm going to need to loop through the same string and look
: for a =
: but using
: $word =~ s/=/ = /
: will also space out the = that is part of the := expression so I would end
: up with
: : =
: instead of
: =
: Is there a way that I can search for the string (=), but do nothing if it
: is part of the larger string (:=)?
Yes, there is. Tell the regular expression that you're searching for =
not preceeded by : . A tweak is that whatever it matches in front of =
must be part of the substitution expression, or get lost:
$word =~ s/([^:])=/$1 = /;
Hope it helps,
Martin
--
| Martin Vorlaender | VMS & WNT programmer
Ceterum censeo | work: mv@pdv-systeme.de
Redmondem delendam esse. | http://www.pdv-systeme.de/users/martinv/
| home: martin@radiogaga.harz.de
------------------------------
Date: Mon, 09 Feb 1998 01:54:04 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
To: Mike Binkley <ThomaJA@LFC.EDU>
Subject: Re: More regular expressions
Message-Id: <34DEA80F.847523@coos.dartmouth.edu>
[posted and mailed]
Mike Binkley wrote:
>
> In a nutshell, I'm looping through a string. One time I'm going to loop
> through it and look for a := using a simple
> $word =~ s/:=/ := /
> [...]
> But then later, I'm going to need to loop through the same string and look
> for a = but using
> $word =~ s/=/ = /
> will also space out the = that is part of the := expression so I would end
> up with
> : =
> instead of
> =
>
> Is there a way that I can search for the string (=), but do nothing if it
> is part of the larger string (:=)?
>
> Oh, and it doesn't matter if I search for the = or := first, so the order
> can be reversed, if necessary.
In that case, why not do them at the same time?
$word =~ s/(:?=)/ $1 /;
But if you really want to do them separately:
$word =~ s/:=/ := /;
$word =~ s/(^|[^:])=/$1 = /;
That last one will match an equal sign either at the beginning of a line, or
after any character other than a colon.
Chipmunk
------------------------------
Date: 9 Feb 1998 07:21:26 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: More regular expressions
Message-Id: <6bmapm$19q$1@marina.cinenet.net>
Kevin Scott (scottj@mthcsc.wfu.edu) wrote:
: Doesn't
:
: $word =~ s/(:=|=)/ $1 /g;
:
: do what you want?
Or even mor directly,
$word =~ s/(:?=)/ $1 /g;
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 9 Feb 1998 07:25:22 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: More regular expressions
Message-Id: <6bmb12$19q$2@marina.cinenet.net>
Martin Vorlaender (martin@RADIOGAGA.HARZ.DE) wrote:
: Yes, there is. Tell the regular expression that you're searching for =
: not preceeded by : . A tweak is that whatever it matches in front of =
: must be part of the substitution expression, or get lost:
:
: $word =~ s/([^:])=/$1 = /;
Note however that this won't catch = at the begining of $word. If you
want to take this route, and for some reason can't use the ':= and = at
the same time' approach others have recommended, and you care about
initial =, use
$word =~ s/(^|[^:])=/$1 = /g;
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Mon, 09 Feb 1998 02:26:32 -0500
From: Larry D'Anna <ldanna@hotmail.com>
Subject: Re: New Perl book reviews
Message-Id: <34DEAFA8.AE9E1C96@hotmail.com>
Bob Trieger wrote:
>
> Andy Lester wrote:
> >
> > I've put up a page of Perl book reviews. There are probably no surprises
> > for regular readers of c.l.p.m., but I've had requests from newbie friends
> > of mine, so there it is.
> >
> > URL is http://ChicagoMusic.com/perl/
>
> Sorry, you can't say it is a list for beginners without mentioning the
> Llama first. The Llama is by far the best perl primer.
>
> just my 2"
IMHO: The Llama is great for non programers wanting to learn perl, but for people who
already know several other languages "Programing Perl" is just as good of a first perl
book.
---------------------------------------------------
|Democracy is the worst system of government. --
|Except for all the others
| -Winston Churchill
---------------------------------------------------
Larry D'Anna "eschew obfuscation"
------------------------------
Date: Mon, 09 Feb 98 02:49:16 +0400
From: "Ben Coleman" <bcoleman@mindspring.com>
Subject: Re: Perl documentation (was re: Perl Year 2000 ...)
Message-Id: <ulpouawgelqyqla.pminews@user-38lclso.dialup.mindspring.com>
On 8 Feb 1998 00:47:59 GMT, Craig Berry wrote:
>That's one reason it's better to use the perldoc command (rather than
>man) to view perl documentation; you can get doc on a single function by
>doing e.g. 'perldoc -f length'.
Is it intended that perldoc -f <function> doesn't page its output, or
is that just a problem with the OS/2 port?
Ben
--
Ben Coleman NJ8J | The attempt to legislatively
Internet: bcoleman@mindspring.com | micromanage equality results, at
http://bcoleman.home.mindspring.com/ | best, in equal misery for all.
------------------------------
Date: Mon, 9 Feb 1998 00:09:26 -0500
From: jdf@pobox.com (Jonathan Feinberg)
Subject: Re: Perl in a datawarehouse environment
Message-Id: <MPG.f485981fa6e517c9896b6@news.concentric.net>
tchrist@mox.perl.com said...
> In comp.lang.perl.misc, eweiss@winchendon.com (Eric Weiss) writes:
> :And coming
> :soon (...real soon :-) ) is a Perl compiler.
>
> Which is not what anyone thinks it is. The compiler does not make
> your program smaller in size, faster in run-time, more portable, more
> maintainable, more secure, nor more robust. In fact, it diminishes all
> those things.
Which is exactly what my company has been looking for. I'm very excited.
Where can we find out more about this exciting new technology?
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: Mon, 09 Feb 1998 05:51:34 GMT
From: dstack@netcom.com (David Stack)
Subject: Re: Perl Win32 and Require's
Message-Id: <34de97f9.17567559@news.supernews.com>
On 6 Feb 1998 22:01:56 GMT, cberry@cinenet.net (Craig Berry) wrote:
>David Stack (dstack@netcom.com) wrote:
>: I am having a problem using the "require" statement with perl on my
>: windows 95 machine. The program is very simple and basically
>: illustrates how to use the "require" statement.
>:
>: The program works fine when I run it from the DOS command line.
>: But when I go to execute the same script through the webserver, I get
>: the following error.
>:
>: >ERROR:
>: >Message: CGI output from d:/musicstack/test/test.cgi
>: >contained no blank line separating header and data
>:
>: If I comment out the "require" statement the program will work fine.
>: Anyone have any ideas?
>
>My guess is that the require is generating an error message (perhaps the
>required file cannot be found under the server environment?). One
>syndrome I've often seen (and sworn at) on NT servers is that . (the
>current working dir) is *not* the dir from which your script is being run
>by the server. This would cause the require to fail, if it's being loaded
>by relative path. Try requiring it by absolute path and see if that
>resolves the problem. If it does, just leave in the absolute path, or
>change your server config (if possible) to make . = app dir.
>
>If none of this works, try the CGI-related newsgroups for more help.
>
Not having an absolute path was the problem!
Before I originally posted to the net, I tried the full path,
but I didn't have the slashes going the right direction.
Perl on Win95
PROPER: require "C:/web/test.pl"
IMPROPER: require "C:\web\test.pl"
I really dislike silly syntax errors. Thanks for the tip.
Dave Stack.
------------------------------
Date: 9 Feb 1998 03:57:35 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: Regex From Hell?
Message-Id: <qz$9802082243@qz.little-neck.ny.us>
Kuntal M. Daftary <daftary@cisco.com> wrote:
> On 3 Feb 1998, Alexis Huxley wrote:
> > perl -ne 'print if (/^(([abc])\1*([xyz])\2*){3}$/)'
> perl -ne 'print if (/^([abc]+[xyz]+){3}$/)'
That will allow "abcxyzbcayzxcabzxy" (etc) which was not allowed as I
recall. Instead the problem asked for ( One of [abc] one or more times
followed by One of [xyz] one or more times ) Pattern repeated three
times. That's what the backreferencing was there for (with the off
by one backreferences being the reason it failed to work).
Elijah
------
sorry, no cigar, better luck next time
------------------------------
Date: 9 Feb 1998 04:31:37 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: Regular expression expander
Message-Id: <qz$9802082259@qz.little-neck.ny.us>
Chipmunk <rjk@coos.dartmouth.edu> wrote:
> Chipmunk wrote:
> > the ones I've tried it on so far. Note that it does not handle
> > Perl's extended regular expression syntax: (?...).
Which includes it not handling non-capturing parens.
> > Aside from that, feel free to find regexes where it screws up.
At a glance it gets character classes slightly wrong.
: elsif ($c eq '[') { # character class
:
: $regex =~ s/^(\^?(?:\\.|[^\]])+)\]//;
$regex =~ s/^(\^?]?(?:\\.|[^]])*)]//;
#!/perl -w
$\ = "\n";
$_ = ' n ] y [p] [ m ]';
s/( [^][] )/uc($1)/eg;
print;
s/ []]+/ew York/;
print;
s/ []py[m\s]+ ] / Perl Mongers/ix;
print;
__END__
:r! perl -x %
N ] Y [p] [ M ]
New York Y [p] [ M ]
New York Perl Mongers
You also don't seem to handle /x at all.
Elijah
------
hasn't looked at it hard yet
------------------------------
Date: 9 Feb 1998 04:59:18 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: regular expressions
Message-Id: <qz$9802082334@qz.little-neck.ny.us>
Mike Binkley <ThomaJA@LFC.EDU> wrote:
> #!/usr/bin/perl
Where is your -w?
> @tokens = qw ( ( ) + ; test);
>
> for ($k = 0; $k < $#tokens; $k++){
> if ($word =~ /@tokens[$k]/){
if ($word =~ /\Q@tokens[$k]\E/){
> So how can I get around this? If I put a \ in front of the @tokens[$k],
> perl starts looking for "@tokens[k]" inside the string, definitely not
> what I want.
quotemeta and/or \Q..\E interpolation are your friends.
> What do I need to do to get perl to look for the individual values? I
> know that I can just break everything up and check for one character at a
> time, but i want to do this as efficiently as possible.
This would be a lot more efficient, if you can work it into your code:
if ($word =~ /[()+;]|test/){
Even this will probably be better:
$re = join '|', map { quotemeta }, @tokens;
if ($word =~ /$re/o){
:r! perl -we '@t=qw( ( ) + ; test);$re=join "|",map{quotemeta}@t;print"$re\n"'
\(|\)|\+|\;|test
Elijah
------
normally /[nypm]/ much better than /n|y|p|m/
------------------------------
Date: Mon, 09 Feb 1998 05:51:36 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: regular expressions
Message-Id: <34de8b58.524144494f47414741@radiogaga.harz.de>
Mike Binkley (ThomaJA@LFC.EDU) wrote:
: @tokens = qw ( ( ) + ; test);
: for ($k = 0; $k < $#tokens; $k++){
: if ($word =~ /@tokens[$k]/){
: print "$word @tokens[$k]\n";
As an aside:
@tokens[$k] is an array slice (i.e. an array consisting of one element),
$tokens[$k] is the scalar stored at index $k of @tokens.
: };
: };
: exit;
: The problem is with those two parentheses and the plus, I keep getting
: told that I can't use the characters.
: For example @tokens[0] is "(" which gives me
: /(/: unmatched ()
: So how can I get around this? If I put a \ in front of the @tokens[$k],
: perl starts looking for "@tokens[k]" inside the string, definitely not
: what I want.
Protect $tokens[$k] from being searched for meta characters:
if ($word =~ /\Q$tokens[$k]\E/)
You'll find \Q mentioned in the perlre POD.
Hope it helps,
Martin
--
| Martin Vorlaender | VMS & WNT programmer
Ceterum censeo | work: mv@pdv-systeme.de
Redmondem delendam esse. | http://www.pdv-systeme.de/users/martinv/
| home: martin@radiogaga.harz.de
------------------------------
Date: Mon, 09 Feb 1998 01:46:33 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
To: Mike Binkley <ThomaJA@LFC.EDU>
Subject: Re: regular expressions
Message-Id: <34DEA64C.C50DE1B2@coos.dartmouth.edu>
[posted and mailed]
Mike Binkley wrote:
>
> The problem is with those two parentheses and the plus, I keep getting
> told that I can't use the characters.
>
> For example @tokens[0] is "(" which gives me
> /(/: unmatched ()
No, $tokens[0] is "(". @tokens[0] is the one-element list ("(").
It's an important distinction, and if you don't learn it it will
definitely come back to haunt you later on.
Now, to answer your question:
/\Q$tokens[0]\E/
This is documented in the perlre manpage.
Chipmunk
------------------------------
Date: Mon, 09 Feb 1998 02:07:45 -0500
From: Larry D'Anna <ldanna@hotmail.com>
Subject: Re: Sharing variables between scripts
Message-Id: <34DEAB41.E25A5C31@hotmail.com>
Brian M. Beaulieu wrote:
>
> I've seen this done before but can't recall how again. All I need to do
> is share variables that are located in 1 perl script between other scripts
> .. I've tried 'require' .. that didn't seem to do the trick (and I did
> give it the relative path to the script with my variables)
>
You need to elaborate.
Are you talking about sharing memory between processes,
or something else? If shared memory is what you want then
mmap would do the trick in C. I don't think it is
currently possible to share variables like that in Perl without
writing an XSub to call mmap and set up the SV, AV, or HV that
you want in the shared memory.
---------------------------------------------------
|Democracy is the worst system of government. --
|Except for all the others
| -Winston Churchill
---------------------------------------------------
Larry D'Anna "eschew obfuscation"
------------------------------
Date: Mon, 09 Feb 1998 01:48:52 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: Strings, numbers, and hash
Message-Id: <34DEA6D6.F3BCE46F@coos.dartmouth.edu>
V. Chandrasekhar wrote:
>
> I have code such as the following:
>
> $asciinum[$kk] = unpack ("C", $chars[$kk]);
> $ebcdicnum[$kk] = $asciitoebcdic{"$asciinum[$kk]"};
> $temp2 = sprintf("%02X", $ebcdicnum[$kk]);
And does that not work?
Chipmunk
------------------------------
Date: Mon, 09 Feb 1998 01:13:14 -0500
From: Larry D'Anna <ldanna@hotmail.com>
Subject: Re: Syntax-coloring editor for NT
Message-Id: <34DE9E7A.C86F3B37@hotmail.com>
Andy Lester wrote:
>
> I'm partial to MultiEdit by American Cybernetics. The Perl coloring is
> pretty good, and I like the editor a bunch, and it's only $100.
>
> xoxo,
> Andy
>
Why pay $100 for some silly little MultiEdit when
GNU Emacs is free and _much_ beter?
---------------------------------------------------
|Democracy is the worst system of government. --
|Except for all the others
| -Winston Churchill
---------------------------------------------------
Larry D'Anna "eschew obfuscation"
------------------------------
Date: 9 Feb 1998 03:49:36 GMT
From: !wclark@coopresources.net (Bill Clark)
Subject: Re: Year 2000 Compliance: Lawyers, Liars, and Perl
Message-Id: <642VpEtJItBf-pn2-GLQY8qeyWidV@localhost>
RandallBart wrote:
> No lie: The data enters the system in decimal. Historically the date
> was punched on a card, later it was entered by key to tape and later
> interactive terminals, but the dates are typed in decimal by a human
> being. Punching two more digits on a card would be expesive --every
> keystroke is an opportunity for error.
Not really. The IBM 026 keypunches could be programmed to take care of
this
-bc-
User friendly software:
That which makes friends of those trying to use it...
------------------------------
Date: Sun, 08 Feb 1998 21:52:26 -0800
From: RandallBart <Barticus@worldnet.att.spam.net>
Subject: Re: Year 2000 Compliance: Lawyers, Liars, and Perl
Message-Id: <6bm5ie$kl7@bgtnsc03.worldnet.att.net>
Bill Clark wrote:
>
> RandallBart wrote:
>
> > No lie: The data enters the system in decimal. Historically the date
> > was punched on a card, later it was entered by key to tape and later
> > interactive terminals, but the dates are typed in decimal by a human
> > being. Punching two more digits on a card would be expesive --every
> > keystroke is an opportunity for error.
>
> Not really. The IBM 026 keypunches could be programmed to take care of
> this
You mean "-" on the drum card? Or was "-" skip and "0" dup? It's been
a while since I programmed a drum card, but I sure madea lot of them.
Okay, we had auto dup, but some cards were squeezed down to the last
column. It would have turned a lot of heads to punch four digit years
into cards.
Zen of punch cards: The data is not where the card is, but where the
card isn't.
--
I |\ Randall Bart mailto:Barticus@usa.spam.net
L |/
o |\ Barticus@worldnet.att.spam.net Barticus@hotmail.spam.com
v | \ 1-818-985-3259 Please reply without spam
e |\
Y |/ Panic in the Year Zero Zero: http://members.aol.com/PanicYr00
o |\ The 28th Term Revealed:
u |/ http://members.aol.com/PanicYr00/Sequence.html
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 1835
**************************************