[8400] in Perl-Users-Digest
Perl-Users Digest, Issue: 2017 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 4 04:07:33 1998
Date: Wed, 4 Mar 98 01:00:27 -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 Wed, 4 Mar 1998 Volume: 8 Number: 2017
Today's topics:
Re: "Learning Perl" or "Programming Perl" <ajohnson@gpu.srv.ualberta.ca>
Re: "Learning Perl" or "Programming Perl" (Abigail)
Re: $0: which OSes? <morpheus+@andrew.cmu.edu>
Re: Detecting Perl version at compile time (Lars Gregersen)
Re: Easy Unix Problem (4 U Guys) <jdludlow@millcomm.com>
Re: Learn Perl on the WEB? - YES!!... well, sorta... (David Waring)
Re: Learn Perl on the WEB? (Brieweb)
Re: NOT matching a string <uri@sysarch.com>
Re: NOT matching a string <stuartc@ind.tansu.com.au>
Re: Perl file mode? <sottek@quiknet.com>
Re: Perl QRG(Quick Reference Guide) (Brieweb)
Q: Emacs and making it indent perl code (Brieweb)
Re: QUIZ: answer and hash slice tutorial <uri@sysarch.com>
Re: QUIZ: answer and hash slice tutorial <stuartc@ind.tansu.com.au>
Re: regex problem - problem with * <ariels@mangal.cs.huji.ac.il>
Re: Stripping (Most) HTML tags (Martin Vorlaender)
Re: Summing Up Array Values - How Do I? (Brieweb)
Re: The -w switch (was Re: better way to do this?) <zenin@best.com>
Re: The -w switch (was Re: better way to do this?) (Lars Gregersen)
Re: What does this one-liner do? <uri@sysarch.com>
Re: What is PERL? Learn JAVA instead? (Brieweb)
Re: What is PERL? Learn JAVA instead? (Rahul Dhesi)
Re: What is PERL? Learn JAVA instead? (Abigail)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 04 Mar 1998 00:00:05 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: "Learning Perl" or "Programming Perl"
Message-Id: <34FCEDE5.7913AB67@gpu.srv.ualberta.ca>
Benjamin Smith wrote:
!
! Thanks for your opinions everyone... I guess I'm gonna have to
! shell out for more than one book... The Camel and one more basic
! level. I'll have to hit the store and read through your
! suggestions.
!
! I have to say though, Tom Christiansen's behaviour on this
! newsgroup has put me off putting money in his pocket. I love my
! other O'Reilly books... it's a pity he's causing me to debate
! purchasing another.
while you're debating, please keep in mind---your money would not
be paying him for his contributions to this group (no one is getting
paid for that)...it would be paying him... and larry, and randal,
and the publishers (and not likely in that order) for producing a
book of exceptional quality which could be an invaluable resource
for your future perl programming. I wouldn't want to see anyone
short-change themselves out of a Llama and/or a camel :-)
regards
andrew
------------------------------
Date: 4 Mar 1998 07:53:03 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: "Learning Perl" or "Programming Perl"
Message-Id: <6dj18v$p6a$1@client3.news.psi.net>
Benjamin Smith (benbean@ionet.net) wrote on 1646 September 1993 in
<URL: news:6dinik$lru$1@ionews.ionet.net>:
++ Thanks for your opinions everyone... I guess I'm gonna have to shell out
++ for more than one book... The Camel and one more basic level. I'll have
++ to hit the store and read through your suggestions.
++
++ I have to say though, Tom Christiansen's behaviour on this newsgroup has
++ put me off putting money in his pocket. I love my other O'Reilly
++ books... it's a pity he's causing me to debate purchasing another.
That's more your loss than Tom's.
(BTW, Tom is an author of The Camel as well)
Abigail
--
I think the books authored by Tom increase the average level of the
O'Reilly books.
------------------------------
Date: Wed, 4 Mar 1998 02:14:49 -0500
From: Gautam Srikanth <morpheus+@andrew.cmu.edu>
Subject: Re: $0: which OSes?
Message-Id: <kozDxdO00YUq1oods0@andrew.cmu.edu>
Excerpts from netnews.comp.lang.perl.misc: 4-Mar-98
Re: $0: which OSes? by Bill Jones@fccjmail.fccj.cc.fl.us
> Hmmm, that's funny, on my Solaris 2.5.1 $0 reflects the ENTIRE name of the
> program as invoked...
That's consistent with Solaris' behavior here: the initial value of $0
reflects the pathname of the program invoked. The trouble is that
assigning to $0 does not change its entry in a 'ps' at all.
Linux is the only system I tried where a program's ps entry matched
changes in $0.
Gautam
-=-=-
Gautam Srikanth - morpheus@andrew.cmu.edu - www.andrew.cmu.edu/~morpheus
"If opera is entertainment, then falling off a roof is transportation" (MAD)
------------------------------
Date: Wed, 04 Mar 1998 08:14:27 GMT
From: lg@kt.dtu.dk (Lars Gregersen)
Subject: Re: Detecting Perl version at compile time
Message-Id: <34fd0d47.80002440@130.228.3.8>
On Tue, 3 Mar 1998 14:44:39 -1000, Ritchard Shadian
<rshadian@hawaii.edu> wrote:
>I have a script which includes the "use" declaration to import a couple of
>modules. However, when this runs under Perl 4 or earlier, the script will
>not compile because "use" is a syntax error in the old Perl. Is there
>some way to detect which version of Perl is running before the script is
>compiled? It would be better to catch it early and return a nice
>formatted error mesage rather than leaving the user to ponder over all the
>"syntax error" messages produced when module subroutines are called.
require 5;
Lars
Lars Gregersen, M.Sc., Chem. Engng.
Technical University of Denmark
Department of Chemical Engineering
E-mail : lg@kt.dtu.dk
Homepage: http://www.gbar.dtu.dk/~matlg/
------------------------------
Date: Wed, 04 Mar 1998 00:15:57 +0000
From: James Ludlow <jdludlow@millcomm.com>
Subject: Re: Easy Unix Problem (4 U Guys)
Message-Id: <34FC9D3C.5AC05BED@millcomm.com>
Elf Sternberg wrote:
[snip]
> To those reading this on comp.lang.perl, is there an easier
> way to split a line 'every nth character' without the cockamamie
> while/for/substr construction I've got up there? I actually have
> wracked my brains on this before without coming up with a satisfactory
> answer.
I'd still love to see this as a one liner, but here's my version of it:
#!/usr/bin/perl -w
# Set up our two varaibles
$big_long_line = "01234567890abcdefghijklmnop";
$split_every = 2;
# Split the line into pieces
@line = (split /(.{0,$split_every})/, $big_long_line);
# Only the odd array members are useful
for ($i=1;$i<=$#line;$i+=2) {
push @foo, $line[$i];
}
# Put the line back together
$line = join " ", @foo;
print "$line\n";
You could use "map" to do this over the entire text file. If $split_every is
greater than the length of the screen, you get the whole string as one
element. If $split_every equals 0 then you get nothing.
--
James Ludlow (jdludlow@millcomm.com)
------------------------------
Date: 4 Mar 1998 07:49:27 GMT
From: dwaring@nwsr.com (David Waring)
Subject: Re: Learn Perl on the WEB? - YES!!... well, sorta...
Message-Id: <dwaring-0303982350500001@blv-lx104-ip41.nwnexus.net>
In article <6dfqhb$iiv$1@unix2.glink.net.hk>,
7sD_.q<V6i <taiwan@glink.net.hk> wrote:
>Dear Perler,
> Just a newbie's question. Any WEB provide online tutorial for PERL ?
This is going to make a bunch of people scream, but I have found a really
good way to learn Perl is to get some of Matt's Scripts and study them, or
better yet try to modify them. They are very well documented, and provide
a way to get functional examples of Perl.
http://www.worldwidemart.com/scripts/
At the same time I will point out that there are some problems here.
First, these are generally Perl 4 scripts that do not make use of object
oriented programming, or the large number of librarys (that Perl people
call modules) that are available to you. There have also been complaints
about his code, from some of the people on this newsgroup. It is not
perfect, but as a way of learning Perl 4 I recommend it. I wish I could
find a collection of Perl 5 scripts that were so well documented that I
could use them as learning tools. Not to say that they are not out there
but I have not found them. In general the web does not provide much Perl
learning support.
Of course if you want to learn Perl YOU MUST get the camel and llama
books, Programming Perl and Learning Perl, pub. O'Reily, available at any
bookstore worth it's salt.
I will point out that dispite another post's suggestion, you really do not
need to learn C, C++, grep, sed and sh/ksh to learn Perl although
experience with each of thes will make Perl easier to learn I have found
that it can also work the other way round. Of course learning any of these
first will make you appreciate the strengths of Perl more.
David
******************************
*
* David Waring
* Freelance Web Developer
* HTML, Perl/CGI, Graphics etc.
* dwaring@nwsr.com
* http://www.nwsr.com
*
******************************
------------------------------
Date: 4 Mar 1998 08:04:01 GMT
From: brieweb@aol.com (Brieweb)
Subject: Re: Learn Perl on the WEB?
Message-Id: <19980304080401.DAA28511@ladder02.news.aol.com>
> Just a newbie's question. Any WEB provide online tutorial for PERL ?
I would say the following is the most under recognized resource for learning
PERL on the web.
http://www.stonehenge.com/merlyn/UnixReview/
Randal Schwartz makes it real easy.
Go there. Also, buy yourself a copy of Learning PERL.
Brian
----------------
Brian Lavender
Napa, CA
Brie Business Directory - Napa Valley http://www.brie.com/bbd
(707) 226-8891
"Have you heard of the new improbability drive?"
------------------------------
Date: 04 Mar 1998 01:06:05 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: NOT matching a string
Message-Id: <x7soozxa5u.fsf@sysarch.com>
tshinnic@io.com.mapSoN (Thomas L. Shinnick) writes:
> On 03 Mar 1998 15:24:09 -0500, Uri Guttman <uri@sysarch.com> wrote:
> >/(X.*)test/
> >print $1 ;
> >this works on all your examples.
> But it would be good to remind miko that this may do _more_ than
> he asked for. If his string was
> "X hi there temp test or not to test"
> then /(X.*)test/ matches "X hi there temp test or not to ",
> but /(X.*?)test/ will just match "X hi there temp ".
he did later post that my answer didn't work. he needed the non-greedy
form you show and someone else posted that too. he never mentioned
anyhting about multiple 'test' strings so i used greedy.
i am not guilty :-)
uri
--
Uri Guttman SYStems ARCHitecture and Software Engineering
uri@sysarch.com Have Perl, Will Hack
http://www.sysarch.com (781) 643-7504 x*2 FAX: (781) 643-2710
Try the Best Search Engine on the Net --------> http://www.northernlight.com
------------------------------
Date: 04 Mar 1998 17:17:51 +1100
From: Stuart Cooper <stuartc@ind.tansu.com.au>
Subject: Re: NOT matching a string
Message-Id: <yeou39f2d4g.fsf@kudu.ind.tansu.com.au>
miko@idocs.com writes:
> I am trying to create a regex in which part of the expression matches any
> amount of text that is NOT some expression.
>
> For example, I would like an expression that essentially says "X" followed by
> anything that isn't "test", so that it matches everything up to but not
> including "test".
>
> For the string "X hi there temp test" it would find "X hi there temp ".
> For the string "Xtest" it would find "X".
> For the string "Xtetetest" it would find "Xtete".
>
> I have tried
>
> /X(?!test)/
>
> but that only matches the X, not all the stuff following it. I also tried
> "/X(?!test)*/" but that is no better.
>
> I hope I'm not asking a FAQ, but I have searched diligently and (perhaps
> because I lack the key vocabulary) haven't found an answer to this anywhere.
> Thanks so much for your help.
>
> -miko
You're a bit confused about the lookahead assertions (?=stuff) and (?!stuff).
These make a string match a RE if stuff follows; but stuff is not made part
of the overall match. It's thrown away and plays no further part.
/X(?=test)/ matches X if it's followed by test
/X(?!test)/ matches X if it is not followed by test.
The () syntax is *not* the () "remember stuff in $1, $2" syntax you usually
see in REs. It's just part of the lookahead syntax.
Here's how to do your job using lookaheads
#! /usr/local/bin/perl -w
$_="X hi there test tmp test";
# $_="X here is some stuff"; # try this one as well
if (/(X.*?)(?=test)/) {
print "matched |$1|\n";
}
The funny ? in (X.*?) makes the * non-greedy; ie match as little as possible;
not as much as possible. This is so it matches only up to the first "test".
So it matches "X hi there " and not "X hi there test tmp "
But a better way of doing it is to have test in the RE proper but not as a
lookahead; and not in the remembered bit. Here goes:
#! /usr/local/bin/perl -w
$_="X hi there test tmp test";
if (/(X.*?)test/) {
# matches a string Xanythingtest; remembers Xanything in $1
print "matched |$1|\n";
}
Hope this helps,
Stuart Cooper
stuartc@ind.tansu.com.au
------------------------------
Date: Tue, 03 Mar 1998 23:12:46 -0800
From: sottek <sottek@quiknet.com>
To: Doug Vermes <dvermes@emerald.tufts.edu>
Subject: Re: Perl file mode?
Message-Id: <34FCFEEE.F425D81F@quiknet.com>
Doug Vermes wrote:
>
> When you use the stat command to get information on a file, one of the
> values it returns is the file mode ($mode). I'm having a hard time making
> sense of this number. It certainly isn't the normal UNIX permissions. For
> example, a file with UNIX permission 600 comes back as 33152. How do I
> translate from one to the other?
> Thanks,
> Doug
>
> ==========================================
> Doug Vermes -- dvermes@emerald.tufts.edu
> Tufts University
> ==========================================
That number IS the file permissions just in decimal
(the 600 is in octal). Here is 33152 in binary.
1000000110000000 now check this out..
1000 000 110 000 000
#### ### -6- -0- -0-
The first set of numbers contains the Directory bit
and some other stuff (I can't remember). The
second set is the special bits. Like if you do a
chmod 6600 .
The next three are what you want.
To see them all nice and pretty do this on a command
line...
perl -e 'printf "%o\n",(0x1ff & (stat("."))[2]);'
A quick what's going on for you (Right to left).
Take the 3rd thing out of the "stat" list
(array item 2) like this
(stat("/filepath/goes/here"))[2]
Bitwise AND it with 0x1ff (111111111 in bin) to strip
off the bits you want.
0x1ff & ....
Give that to a printf with an Octal output!
printf "%o", ... use sprintf if you need to keep it
somewhere.
Give it all to perl on the command line and you have
a very nice chmod looker upper!
------------------------------
Date: 4 Mar 1998 07:46:47 GMT
From: brieweb@aol.com (Brieweb)
Subject: Re: Perl QRG(Quick Reference Guide)
Message-Id: <19980304074601.CAA02296@ladder03.news.aol.com>
>Does anyone know of a Perl quick reference guide they could point me to
When I bought the 1st edition of programming perl it came with a quick
reference guide. The second edition did not come with one.
Brian
----------------
Brian Lavender
Napa, CA
Brie Business Directory - Napa Valley http://www.brie.com/bbd
(707) 226-8891
"Have you heard of the new improbability drive?"
------------------------------
Date: 4 Mar 1998 07:43:14 GMT
From: brieweb@aol.com (Brieweb)
Subject: Q: Emacs and making it indent perl code
Message-Id: <19980304074301.CAA27115@ladder02.news.aol.com>
I have been playing with GNU Emacs on my windoze 95 machine.
I figured out how to invoke perl mode with m-x perl-mode. I tried this and I am
totally stoked the way it automatically indents the code when you type it in.
The problem:
I have some code I want to put in a subroutine. I want it to automatically
indent it. I killed a region of text, created the subroutine structure
sub sample {
}
and then I yanked the the code into the middle. The thing is I want it to
automatically indent it, or run a routine on it that indents it. It does it
when I type it in, but when I yank it into an area, it does not. How do I make
it indented?
Here is another thing I would like to do. I read that there is the
cperl-mode.el with the perl distribution. Problem is with my GNU emacs on my PC
running win95 I see all the lisp routines end in .elc . Does that mean they are
compiled. Do I have to compile it?
Thanks,
Brian
----------------
Brian Lavender
Napa, CA
Brie Business Directory - Napa Valley http://www.brie.com/bbd
(707) 226-8891
"Have you heard of the new improbability drive?"
------------------------------
Date: 04 Mar 1998 01:02:33 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: QUIZ: answer and hash slice tutorial
Message-Id: <x7u39fxabq.fsf@sysarch.com>
Bill Jones <webmaster@fccjmail.fccj.cc.fl.us> writes:
> Hmmm. Since Perl was originally targeted to C programmers, maybe
> a start at the beginning would prove helpful for a 'beginners Quiz?'
well since larry claims it is descended from C, sh, awk and sed, who
knows WHO it was targeted for? and today it has no particular target
AFAIK. it just is a damn fine programming language and system.
i wasn't aiming my quiz at newbies per se. i just found an interesting
idiom and wanted to share it with whoever could use it. my tutorial is
definitely NOT aimed at the "i just learned perl this week and i am
writing a complex CGI system, please help me!" crowd. it is more for
those who use perl and want to learn soemthing usefule and maybe
interesting that they didn't already know.
newbies should read learning perl or the on-line tutorials. in fact
there should be more of those from what i gather. www.perl.com should be
linked to all that are out there and we should point newbies to that.
fortunately i never was a true newbie, having read camel 8 years ago
and never having looked back. i don't know the best way to teach them
especially the ones who have NO computer science education. perl is NOT
a toy, though you can play with it and have lots of fun.
enough newbie flame for now,
enjoy the tutorial. if i get requests i will put it on my web site.
uri
--
Uri Guttman SYStems ARCHitecture and Software Engineering
uri@sysarch.com Have Perl, Will Hack
http://www.sysarch.com (781) 643-7504 x*2 FAX: (781) 643-2710
Try the Best Search Engine on the Net --------> http://www.northernlight.com
------------------------------
Date: 04 Mar 1998 18:53:14 +1100
From: Stuart Cooper <stuartc@ind.tansu.com.au>
Subject: Re: QUIZ: answer and hash slice tutorial
Message-Id: <yeosooy3n9x.fsf@kudu.ind.tansu.com.au>
> the original code was this and i asked what good is it?
> @array = qw( a b c d ) ;
> @array{ @array } = ( [ @array ] ) x @array ;
Is it "I touch myself" by the Divynyls?
Stuart Cooper
stuartc@ind.tansu.com.au
------------------------------
Date: 04 Mar 1998 09:43:58 +0200
From: Ariel Scolnicov <ariels@mangal.cs.huji.ac.il>
Subject: Re: regex problem - problem with *
Message-Id: <7z4t1eq4sh.fsf@mangal.cs.huji.ac.il>
dwaring@nwsr.com (David Waring) writes:
> I cannot for the life of me figure out this problem. I am not new to
> regex's but this confuses me. I am simply trying to grab a number frome a
> line but if I use \d* it does not work while \d+ does. Here is a printout
> of my code and the result:
>
> [69] /www/bwaring/cgi-pvt>m a.pl
> #!/usr/local/bin/perl
>
> $line="blah blah blah 100 blah blah";
> if ($line=~/(\d*)/){
> $num=$1;
> print "found it\n";
> }
> print "num= $num\n";
>
> [70] /www/bwaring/cgi-pvt>a.pl
> found it
> num=
> [71] /www/bwaring/cgi-pvt>
>
> Why is this not working?
Consider what you're doing when searching with m/(\d*)/: you're
looking for the first position in the string containing zero or more
digits, and matching the most possible digits at that location. What's
the first position in your string containing zero or more digits?
------------------------------
Date: Wed, 04 Mar 1998 04:42:37 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: Stripping (Most) HTML tags
Message-Id: <34fccdad.524144494f47414741@radiogaga.harz.de>
Kari Marttila (Kari.Marttila.@tietogroup.com) wrote:
> Abigail wrote:
>> Tim Archer (tarcher@csu.edu.au) wrote:
>>> I am looking for a perl script that will strip all tags except for a
>>> given list from a document.
>>
>> What is it that HTML::Parser doesn't give you?
>
> I have the same problem. I should write a perl script that parses all
> html tags away from the text. Could someone tell us a simple example how
> to use HTML::Parser (to make a subclass and override one method).
Randal Schwartz' Web Techniques columns (IMHO, required reading, anyway)
#7, #14, and #22 use the HTML::Parser class.
The base URL is http://www.stonehenge.com/merlyn/WebTechniques/
As for subclassing... there's perlobj.pod and perltoot.pod.
cu,
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: 4 Mar 1998 07:56:04 GMT
From: brieweb@aol.com (Brieweb)
Subject: Re: Summing Up Array Values - How Do I?
Message-Id: <19980304075601.CAA02921@ladder03.news.aol.com>
>I guess I should mention I only learned perl about a
>week ago.
You ought to buy yourself a copy of Learning PERL. It has this exact example in
the book.
----------------
Brian Lavender
Napa, CA
Brie Business Directory - Napa Valley http://www.brie.com/bbd
(707) 226-8891
"Have you heard of the new improbability drive?"
------------------------------
Date: 4 Mar 1998 07:26:49 GMT
From: Zenin <zenin@best.com>
Subject: Re: The -w switch (was Re: better way to do this?)
Message-Id: <888996750.645870@thrush.omix.com>
[ posted & mailed ]
Tom Christiansen <tchrist@mox.perl.com> wrote:
: In comp.lang.perl.misc, Zenin <zenin@best.com> writes:
: : I *highly* disagree this advice for some uses. When left in CGI
: : code, it can be deadly.
:
: Why aren't you using CGI::Carp??
I do. It makes my error log files pretty, but does little to
nothing to fix the problem. If I don't use carpout it's still
going to cause a server error and break my entire site. Yes,
I could use carpout to redirect to some file, but which file? One
for each CGI is kinda silly. Either way, sending it all to a file then
makes me worry about my disks blowing up at each perl upgrade when
a 100 CGI's all start spiting out tons of warnings I could care less
about and have only about %.001 chance of actually affecting the
running of the program. Redirecting it to /dev/null is an option,
but no better then nuking -w when the script goes into production.
There is the option of sending it to the browser. This is great for
development, but a security hole for production my clients (nor I)
would allow, and it STILL would create HUGE unneeded log files.
-Yes, log file size is a major concern when you have web sites
that generate a few *gigs* of log files a month *normally* and
that's just the access logs of one of many sites that could be
on the machine.
And even if all this was a Good Thing[tm] for whatever reason, how
do I convince my clients that it's possible they may need to pay
to have *working* code "fixed" each time perl is upgraded?!?! The
quick answer is they wouldn't. Perl would *never* get upgraded,
installing modules gets harder and harder as they require later and
later versions, and I have to put up with bugs that where fixed
releases ago... It's hard enough to get places to upgrade perl4 for
exactly the same reasons, but to then tell them it could happen
every time they upgrade a minor version number would not fly well
at all.
Nuke -w from production code if it has a hint of chance to break it
when perl is upgraded. Unless someone has a
"use nuke_all_new_warnings (5.00401)" pragma module it's a must.
The only other option is to compile the scripts with perl statically
linked so that it never again sees an update. I hate this idea.
--
-Zenin
zenin@best.com
------------------------------
Date: Wed, 04 Mar 1998 07:47:59 GMT
From: lg@kt.dtu.dk (Lars Gregersen)
Subject: Re: The -w switch (was Re: better way to do this?)
Message-Id: <34fd04fd.77879774@130.228.3.8>
On 4 Mar 1998 01:30:28 GMT, Zenin <zenin@best.com> wrote:
>Tom Christiansen <tchrist@mox.perl.com> wrote:
>: In comp.lang.perl.misc, Jon Drukman <jsd@hudsucker.gamespot.com> writes:
> >snip<
>: :says you should probably turn -w off for production
>: :programs. (-w is a speed hit and also you don't want your end users
>: :seeing your warnings.)
>:
>: That's wrong. Leave them in. If it screws up in production,
>: you need to know why. Don't remove them.
>
> I *highly* disagree this advice for some uses. When left in CGI
> code, it can be deadly. Why? Because if a perl upgrade causes a
> new (but likely harmless) warning to be spit out that never was
> before, it will almost certainly cause a "Server Error" do to
[snip]
and how exactly are you going to find out if the change is something
that you have to worry about when you do not see the warnings? Besides
putting in new warnings to assist an existing Perl version the
warnings could be a result of new features and/or bugs that you might
want to know about - not to mention undetected bugs in your code. This
is especially important in CGI code.
Lars
Lars Gregersen, M.Sc., Chem. Engng.
Technical University of Denmark
Department of Chemical Engineering
E-mail : lg@kt.dtu.dk
Homepage: http://www.gbar.dtu.dk/~matlg/
------------------------------
Date: 04 Mar 1998 01:18:36 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: What does this one-liner do?
Message-Id: <x7ra4jx9kz.fsf@sysarch.com>
Jaime Metcher <metcher@spider.herston.uq.edu.au> writes:
> Chipmunk, I like your explanation, but...
>
> I don't really have a problem with perl's behaviour in this regard. I'm
> just trying to figure out if I have a problem with the documentation.
> I've indulged in some more hairsplitting below, if you've the patience
> to educate me further.
see my earlier post on array vs. list context.
assigning an array variable in a scalar context is the only time you get
the length of the array. array variables are NOT lists.
@array is an array variable
( @array ) is a list with the values of the variable @array
$foo = @array is the length of @array
$foo = ( @array ) is the last element of @array
can't get any simpler. all of the other case in this thread fall out if
you just follow those rules. list context or scalar context is it.
> my @list = (7,8,9);
>
> Isn't @list the variable? And my example below demonstrates that the
> value of the assignment (in list context) is the value of the LHS -
> which is usually where we put "the variable". I think the quote from
> the Camel is saying "the new value of the variable" where it means "the
> value assigned to the LHS".
an array variable is NOT a list. it creates a list context in assignments.
all expressions get evaluated in a context. the context may change in a
statement. you have to properly parse the statement to isolate the
contexts. then you eveluate each expression in their context in
precedence order. so assignments (which is just an expression with a
side effect) are evaluated in a context that is ouside the context used
to evaluate the expression being assigned. (is that clear?)
> > You are attempting to make a rule which covers both scalar and list
> > assignment. There are already rules that cover scalar and list assignment
> > separately. Trying to make a single rule only confuses the issue.
exactly. see my earlier post for much more on this.
uri
--
Uri Guttman SYStems ARCHitecture and Software Engineering
uri@sysarch.com Have Perl, Will Hack
http://www.sysarch.com (781) 643-7504 x*2 FAX: (781) 643-2710
Try the Best Search Engine on the Net --------> http://www.northernlight.com
------------------------------
Date: 4 Mar 1998 07:53:08 GMT
From: brieweb@aol.com (Brieweb)
Subject: Re: What is PERL? Learn JAVA instead?
Message-Id: <19980304075300.CAA27800@ladder02.news.aol.com>
>I really don't know crap about PERL.
Now is a good time to learn. Has this thread gone through here before. This guy
sounds like he is trying to get us riled up. I wonder what sort of code he has
written.
>Which one is better?
I definitely like perl. It is easy. A language's strength comes from people who
write code in it. PERL has that.
I heard Randal Schwartz say he could write an entire httpd server in 90 lines
of PERL.
>What can I use it for?
Lot's o things. Perl is real trick for database connectivity and easily
generating CGI's. It has cool tools for text manipulation. You ought to buy
Learning PERL by Randal Schwarz and Tom Christiansen.
----------------
Brian Lavender
Napa, CA
Brie Business Directory - Napa Valley http://www.brie.com/bbd
(707) 226-8891
"Have you heard of the new improbability drive?"
------------------------------
Date: 4 Mar 1998 07:53:15 GMT
From: c.c.eiftj@03.usenet.us.com (Rahul Dhesi)
Subject: Re: What is PERL? Learn JAVA instead?
Message-Id: <6dj19b$dom$1@samba.rahul.net>
In <6dhrod$t0s$2@info.uah.edu> gbacon@cs.uah.edu (Greg Bacon) writes:
>Using the sizes of Perl's and Java's respective user bases as a basis
>for comparison, Perl seems to be much more useful for everything, not
>just the simple task of crippling someone's machine with rogue code.
And Perl is far more portable. Java's machine independence is a myth.
Sun's Java development kit will only run on two software platforms
(Solaris and Microsoft's windowing systems) on two hardware platforms
(SPARC and Intel x86).
Perl runs just about everywhere. Java doesn't run even on Sun's own
SunOS operating system.
--
Rahul Dhesi <dhesi@spams.r.us.com>
------------------------------
Date: 4 Mar 1998 08:01:25 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: What is PERL? Learn JAVA instead?
Message-Id: <6dj1ol$p6a$2@client3.news.psi.net>
Zenin (zenin@best.com) wrote on 1646 September 1993 in
<URL: news:888978736.262623@thrush.omix.com>:
++
++
++ : some of its key advantages are its cross-platform capabilites,
++
++ Java in it's current state is one of the most non-crossplatform
++ languages on the street, despite what the hype would have you
++ beleve otherwise. Java has brought the "Write once, debug
++ everywhere" design cycle to new heights.
Some once said:
``When was the last time you bought a Java application with the box
saying "Runs everywhere"?''
Perl and Python are probably more suitable for cross platform programs
than Java.
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle 'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Additional/s) [0]'
------------------------------
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 2017
**************************************