[8398] in Perl-Users-Digest
Perl-Users Digest, Issue: 2015 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 3 22:18:32 1998
Date: Tue, 3 Mar 98 19:00:24 -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 Tue, 3 Mar 1998 Volume: 8 Number: 2015
Today's topics:
Re: "Learning Perl" or "Programming Perl" (Abigail)
$0: which OSes? <morpheus+@andrew.cmu.edu>
Re: contexts: is there such a thing as array? <uri@sysarch.com>
Re: Cookie question <anatolii.belomestnov@gecapital.com>
Debugging Perl and extensions (Perl gurus please help) gupit@yahoo.com
differences between v 5.001 & 5.004 <npaci@bigfoot.com>
Display highest number (Chuck Stewart)
Re: HTTP <webmaster@fccjmail.fccj.cc.fl.us>
Re: http:// replacement (Abigail)
Re: recursion counter bug <webmaster@fccjmail.fccj.cc.fl.us>
Re: recursion counter bug <webmaster@fccjmail.fccj.cc.fl.us>
Re: rsh a continuous unix command remotely <webmaster@fccjmail.fccj.cc.fl.us>
Re: rsh a continuous unix command remotely (Farid Hamjavar)
Re: Stripping (Most) HTML tags (Abigail)
Re: subdirectory search? (Mike Stok)
Re: Summing Up Array Values - How Do I? (Jeffrey Drumm)
Re: Summing Up Array Values - How Do I? (Jim Allenspach)
Re: Summing Up Array Values - How Do I? <uri@sysarch.com>
Re: The -w switch (was Re: better way to do this?) (Abigail)
Re: The -w switch (was Re: better way to do this?) <zenin@best.com>
Re: What is PERL? Learn JAVA instead? (Abigail)
Re: What is PERL? Learn JAVA instead? <zenin@best.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 4 Mar 1998 01:14:47 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: "Learning Perl" or "Programming Perl"
Message-Id: <6di9u7$kdk$3@client3.news.psi.net>
Jeff Barnes (psrjeff@exisnospam.net) wrote on 1645 September 1993 in
<URL: news:6dhmv6$l43$1@grouper.exis.net>:
++
++ steve wrote in message <35007b0f.131669540@news.cent.com>...
++ >as a " Windows developer familiar with C, C++, Pascal and all sorts
++ >of OSs and major and minor languages" i would say neither, i would
++ >instead suggest "Cross Platform Perl" for Unix and Windows NT" by Eric
++ >R. Johnson ISBN 1-55851-483-X
++
++ As a beginner, I bought the book and learned some from it. However, I very
++ quickly outgrew the information it presented. It doesn't even discuss the
++ split operator. If one needs to learn regexp, then I would think that split
++ should be a part of that block of instruction.
I know 6 books that I can recommend. From most important to least:
- Programming Perl
- Mastering Regular Expression
- Perl: The Programmers Companion
- Advanced Perl Programming
- Learning Perl
- Effective Perl Programming
And if you want to read them all, the best order is probably (first to last):
- Learning Perl
- Perl: The Programmers Companion
- Programming Perl
- Mastering Regular Expression
- Effective Perl Programming
- Advanced Perl Programming
Programming Perl and Mastering Regular Expressions are absolute musts.
Of course, this is all just my opinion, YMMV.
Abigail
--
perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
print+Just (), another (), Perl (), Hacker ();'
------------------------------
Date: Tue, 3 Mar 1998 20:06:32 -0500
From: Gautam Srikanth <morpheus+@andrew.cmu.edu>
Subject: $0: which OSes?
Message-Id: <Moz_YMS00YUq1ooVA0@andrew.cmu.edu>
Found in perlfaq8:
>>>
To actually alter the visible command line, you can assign to the
variable $0 as documented in the perlvar manpage. This won't work on all
operating systems, though. Daemon programs like sendmail place their
state there, as in:
$0 = "orcus [accepting connections]";
>>>
And the question... under which OSes will ps reflect the changed command
line? In my testing
- Linux 2.0.33 does
- Solaris 2.5.1 and HP/UX 9.05 do not.
Anyone know why this happens? Better yet, is there a workaround for
systems where modifying $0 fails?
thanks in advance --
Gautam
------------------------------
Date: 03 Mar 1998 21:34:15 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: contexts: is there such a thing as array?
Message-Id: <x71zwjyyjc.fsf@sysarch.com>
this is great. whether i can explain or clarify the question, it is an
intelligent discussion of a perl topic. it is not an FAQ, CGI, newbie
type of question!
kcohen@julius.ling.ohio-state.edu (Kevin B Cohen) writes:
> my basic question: is it Correct to speak of there being such a thing
> as array context in perl, as distinct from list context? we learn
> early on that there's a difference between scalar context and list
> context, and if we've looked on p. 45 of the blue camel we know that
> there are different flavors of scalar context:
>
> "Scalar context can be further classified into string context,
> numeric context, and don't-care context."
>
> i'm wondering, then, if list context can also be broken down into list
> context and array context.
no, there is no array context. context is used in the evaluation of
expressions. so there can be no array context since an array is a
variable and not an expression context.
> @stuff = ("one", "two", "three");
> # yes, the blue camel really uses double quotes, as do i...
> $stuff = ("one", "two", "three");
> # $stuff contains C<three>
> $stuff = @stuff;
> # $stuff now holds C<3>
>
> different behavior with the array @stuff versus with the list ("one",
> "two", "three"), so let's call bread bread and wine wine and conclude
> that these are different contexts.
wrong. an array variable evaluated in a scalar context gives the number
of elements in an array. a list evaluated in an scalar context give the
last element of the list.
$stuff = ( @stuff ) ;
$stuff is 'three' not 3. the context is a list and not scalar and so the
scalar gets the last element of the list.
> maybe that's not such a good line of argumentation, though. in these
> examples, the array and list are on the right-hand side of the
> operation, and "context" seems, implicitly, to be determined by the
> left-hand side:
>
> "...assignment to a scalar variable evaluates the right-hand side in a
> scalar context, while assignemtn to an array or a hash... evaluates
> the right-hand side in a list context." (45)
this is slightly unclear. they mean an array or hash VARIABLE. you can
have an array or hash on the left hand side in a scalar context by
indexing into it. the RHS or LHS is irrelevant. it is the context which
can be created in many ways on either side of =.
$foo{ 'bar' } = @bar ;
is an assignment of an array in a scalar context which is the length of bar.
> so, consider instead some behavioral differences that we see (or seem
> to see; maybe i'm off track) if the array vs. list is on the LHS. if
yes ^^^^^^^^^^^^^^^^^^^ :-)
> we have these two things on the left hand side of a match operator, we
> can pack a lot more into the array than we can into the list. e.g.:
yes. it is not a different context. it is truncation of the full
list from the match. if you used an array slice on either side os the
assignment you could get the same truncation effect.
> $string = "It is a truth universally acknowledged";
> ($one, $two) = /(\w+) (\w+)/g;
> print "$one $two\n";
> @array = /(\w+) (\w+)/g;
> $thing = join(' ', @array);
> print "$thing\n";
> the list and the array got different things from the match operator:
> should we not, then, say that they induce diffferent contexts?
($one, $two) = ( /(\w+) (\w+)/g )[ 1, 2 ] ;
@array = ( /(\w+) (\w+)/g )[ 1, 2 ] ;
@array[1, 2] = /(\w+) (\w+)/g ;
these all only assign 'It', 'is'
> right now you're thinking, "oh, kevin---it's not that the array and
> the list impose different contexts, but rather the fact that *they are
> different things* that causes them to get different things from the
> match operator. the array is a practically bottomless tank, while the
> list is a holder for two, and only two, things. no surprise, then,
> that their contents are different.
yes. why do you keep trying to think otherwise?
> well, maybe you're right. in fact, i think i can give a good argument
> for your point of view. consider what happens if that match contains
> an optional parenthesized thing that is not present in the string
> against which we are matching.in such a case, if in fact there WERE a
> real (contextual) difference between list and array contexts, my
> expectation is that the list element corresponding to the
> optional-and-absent stuff would be undefined; however, i would expect
> that the array would have no undefined elements. turns out that the
> array does, in fact, seem to have an undefined element:
>
> @array = /(\w+)(\d+\s)(\w+)/;
> $thing = join('*', @array);
> ($one, $two, $three) = /(\w+)(\d+\s)(\w+)/;
> print "one: $one two: $two three: $three\n";
> print "$thing\n";
>
> this produces:
>
> one: It two: three: is
> It**is
i don't see what point you are making here. you had enough room for 3
elements in both cases so you got 3 elements, regardless of a value
being undef.
> so, there doesn't seem to be a difference, here, in the behavior of
> the match operator with a list on the LHS, versus with an array on the
> LHS.
the match operator (or any list generating expression) generates the
list of values in the list context. THEN the list is assigned (assuming
assignment which is not necessary). the list can be fully assigned to an
array or partially assigned into a shorter list of scalars or an array
slice.
> what's the truth?? are there separate list and array contexts, or am i
> full of it?
you must have brown eyes, you are so full! :-)
good try though. better luck next time!! next contestant please!
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: Tue, 03 Mar 1998 10:03:24 -0500
From: Anatolii Belomestnov <anatolii.belomestnov@gecapital.com>
To: "Jan H.W.G." <info@realm.nl>
Subject: Re: Cookie question
Message-Id: <34FC1BBC.94960D11@gecapital.com>
Jan,
Cookies are sent within the HTTP header, and I dont think they are
in a HTML tag format like you described.
Just what is the cookie.lib exactly? Look for RFC specs about
HTTP protocol and particularly cookies. Yahoo is a good resource
for that kind of stuff.
Also be sure to include all cookies before you close the HTTP
header because if not then they dont get sent.
Anatolii
Jan H.W.G. wrote:
>
> Hello,
>
> I have trided and trided to install the cookie script from
> matt@worldwidemart.com but it seems to be that I still have to learn a
> lot.
>
> My Question:
> After configer and installing the script " cookie.lib " it doesn't
> work. Do I have to put something in the head from the HTM(L) page ?
> <META HTTP_COOKIE="set cookie"> or something like that ?
>
> Or should the cookie start automatical from the script ?
>
> I have read and read again but I can't find the sollution,
> Please who can help me .
>
> With best regards,
> Jan
>
>
------------------------------
Date: Tue, 03 Mar 1998 19:47:33 -0600
From: gupit@yahoo.com
Subject: Debugging Perl and extensions (Perl gurus please help)
Message-Id: <6dibqn$nis$1@nnrp1.dejanews.com>
Hello,
I am trying to debug an extension I wrote for Perl. The extension is
dynamically loadable. I built a Debugging version of perl (BTW any ideas on
how to "make" a debugging version of perl share the libs etc of an existing
normal version perl binary?) and ran it under gdb. However the function I
wanted to break on in my .xs file is loaded dynamically. Is there a procedure
to be followed to allow setting breakpoints at these type of functions?
I also tried building a statically linked version. It does break, but
somewhere inside the function. Stepping a few times starts the execution
of the function. But it keeps on hanging in the middle. Any ideas?
While I am at it, let me ask the question which prompted me to try to debug
perl.
I am returning a reference to a hash of hashes from a C function. I declared
the top hash mortal.
One of the nested data structure is an array. I create new SV's and push them
in this array. If I create mortal versions of these SV's, I get unknowns in my
perl script.
When I looked at av_push, I found that only the pointer to the SV is stored in
the array entry. That would explain unknown since the SV is freed after my C
functions is returned.
But then when I change the original SV, the array entry doesn't change (whcih
is correct). What exactly happens when I push a scalar and change the scalar?
Is there some magic going on?
Thanks,
Gupit
Thanks in advance,
Gupit
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Tue, 03 Mar 1998 21:41:51 -0500
From: Noah Paci <npaci@bigfoot.com>
Subject: differences between v 5.001 & 5.004
Message-Id: <34FCBF6E.6EF1493F@bigfoot.com>
what are the differnces between the versions or where can I look? I
wrote some code on my mac for a unix machine. The code worked on my
machine but failed on the unix machine which was running the lesser
version. It turned out that I had to preface all of my function calls
with &. Are there other booby traps that anyone can advise me of or
refer me to a location that documents the differences?
Thanks,
Noah Paci
npaci@bigfoot.com
------------------------------
Date: Wed, 04 Mar 1998 01:57:27 GMT
From: cstewart@flash.net (Chuck Stewart)
Subject: Display highest number
Message-Id: <34fcb3b6.4057237@news.flash.net>
I have a tab delimited file with a name and 10 numbers (dupe number is
possible).
jack 77 45 45 12 90 etc
jill 90 44 29 87 34 etc
What I need to do is write to a file jack and jill's highest 3
numbers. My sort knowledge is limited. Help is appreciated. Thanks
so much....
------------------------------
Date: Wed, 04 Mar 1998 01:10:37 GMT
From: Bill Jones <webmaster@fccjmail.fccj.cc.fl.us>
Subject: Re: HTTP
Message-Id: <34FCA8D7.96B44B28@fccjmail.fccj.cc.fl.us>
Maybe possibly too obvious, but have you looked at port 443?
Http operates on 80, but some forget that https operates on 443 :-)
(Unless someone at your org has changed it, for whatever reason...)
HTH,
Bill
Curt Peredina wrote:
> Im trying to write a ping utility for my site which utilizes HTTPS.
>
> I have a working pgm for HTTP, but cannot get it to work with HTTPS.
> Could someone give me an idea of how best to implement this,
> possibly using the HTTP, LWP, or some other module which I have not yet
> found?
>
> Any information pointing me in the correct direction would be
> appreciated.
>
> Thanks in advance....
------------------------------
Date: 4 Mar 1998 01:17:26 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: http:// replacement
Message-Id: <6dia36$kdk$4@client3.news.psi.net>
Kelby Valenti (kelby@mplx.com) wrote on 1645 September 1993 in
<URL: news:6dhrvd$6rl@aaron.hamilton.edu>:
++ I want to replace a link within a body of text with it's actual link. For
++ example:
++ "Look at http://~~~~~~~~~~~ for more info."
++ would be "Look at <a
++ href=http://~~~~~~~~~~~~~~~>http://~~~~~~~~~~~~~~</a> for more info."
++ I would like to replace http://~~~~~~~ with <a
++ href=http://~~~~~~~~~>http://~~~~~~~~</a>. Is there any way to do this?
++
http;//cthulhu.mandrake.net/%7Eabigail/Perl/url.html
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: Wed, 04 Mar 1998 01:30:17 GMT
From: Bill Jones <webmaster@fccjmail.fccj.cc.fl.us>
Subject: Re: recursion counter bug
Message-Id: <34FCAD73.7DCF8E64@fccjmail.fccj.cc.fl.us>
Wins my vote for most explicit use of die :-)
Funny, as well!
Bill
Thomas Ballard wrote:
> The following will only loop 100 times in debug mode because the
> recursion counter gets confused by the eval.
>
> #!/usr/bin/perl -d
>
> sub crash
> {
> die('Ack! Ya got me, pal. Flop.');
> }
>
> # main
> {
> my $loops = 1000;
> while ($loops--)
> {
> eval { crash() };
> print("$loops. $@") if $@;
> }
> }
>
> Tom Ballard
------------------------------
Date: Wed, 04 Mar 1998 01:45:13 GMT
From: Bill Jones <webmaster@fccjmail.fccj.cc.fl.us>
Subject: Re: recursion counter bug
Message-Id: <34FCB0F3.25F7CC06@fccjmail.fccj.cc.fl.us>
On my system, $! returns - No such file or directory.
Oh, and it doesn't die, it keep going til 0 is reached...
Hmmm.........
Thomas Ballard wrote:
> The following will only loop 100 times in debug mode because the
> recursion counter gets confused by the eval.
>
> #!/usr/bin/perl -d
>
> sub crash
> {
> die('Ack! Ya got me, pal. Flop.');
> }
>
> # main
> {
> my $loops = 1000;
> while ($loops--)
> {
> eval { crash() };
> print("$loops. $@") if $@;
> }
> }
>
> Tom Ballard
------------------------------
Date: Wed, 04 Mar 1998 01:22:16 GMT
From: Bill Jones <webmaster@fccjmail.fccj.cc.fl.us>
To: Farid Hamjavar <hamjavar@unm.edu>
Subject: Re: rsh a continuous unix command remotely
Message-Id: <34FCAB91.75A3A671@fccjmail.fccj.cc.fl.us>
Mailed and Posted:
I understand the problem - server/client may timeout while waiting for
input.
I have implemented a similar solution as shown below -
On the server you wish to monitor (using nohup):
netstat 2 >> $DocRoot/netstat2.html
Inside the 'appended' html file I had '<meta http-equiv=refresh
content='3;url=http://somehost.com/netstat2.html'>
Not elegant, but it worked that way I wanted while I learned how to do
other things...
(A Perl beginner, like me, needed to become self-profiecent someway :-)
HTH,
Bill
Farid Hamjavar wrote:
> greetings,
>
> I have already implemented what I describe below
> in ksh (few lines) and is working fine, but I
> like to implement it in perl if I can.
>
> Task:
> There are unix commands that continuously generate out put.
> Let's consider "netstat 2" which outputs every 2 seconds.
>
> How is it done in perl to do the following pseudo code:
>
> rsh remotehost netstat 2 >> somefile
>
> in background.
>
> I am trying to avoide things like this:
>
> % rsh aix netstat 2 >> /scratch/junkfile &
> [1] 36198
> %
> [1] + Suspended (tty input)rsh aix netstat 2 >> /scratch/junkfile
>
> Thanks,
> Farid
------------------------------
Date: 3 Mar 1998 19:48:40 -0700
From: hamjavar@unm.edu (Farid Hamjavar)
Subject: Re: rsh a continuous unix command remotely
Message-Id: <6dife8$lg4@pegasus.unm.edu>
On Tue, 3 Mar 1998, Bill Jones wrote:
> I understand the problem - server/client may timeout while waiting for
> input.
> I have implemented a similar solution as shown below -
>
> On the server you wish to monitor (using nohup):
> netstat 2 >> $DocRoot/netstat2.html
>
> Inside the 'appended' html file I had '<meta http-equiv=refresh
> content='3;url=http://somehost.com/netstat2.html'>
>
> Not elegant, but it worked that way I wanted while I learned how to do
> other things...
> (A Perl beginner, like me, needed to become self-profiecent someway :-)
Thanks for reply, but I don't see
where "rsh" comes to play?
To re-phrase my question and inllustrate:
Example:
I want to capture never-ending output
of "netstat 2" on host "B" into a
nfs-accessible file named COLLECT by
rsh-ing from host "A" without even touching
host "B" other than the fact that I
need to rsh into it.
The shell version which is already working
is like this which gets "re-spawned" via
unix's initialization table (inittab in aix)
#!/bin/ksh
junkfile=/scratch/junk
if [ -f ${junkfile} ]
then
> ${junkfile}
rsh remotehost netstat 2 1>>${junkfile} 2>&1
else
touch ${junkfile}
fi
Thanks,
Farid
------------------------------
Date: 4 Mar 1998 01:00:17 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Stripping (Most) HTML tags
Message-Id: <6di931$kdk$1@client3.news.psi.net>
Kari Marttila (Kari.Marttila.@tietogroup.com) wrote on 1645 September
1993 in <URL: news:34FC25F1.4B23@tietogroup.com>:
++
++ 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).
Which part of the manual didn't you understand?
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
------------------------------
Date: 4 Mar 1998 00:59:34 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: subdirectory search?
Message-Id: <6di91m$4sp@news-central.tiac.net>
In article <34FC83E7.4F8ED131@hotmail.com>,
John Guisson <mrpc1@hotmail.com> wrote:
>how do i get a list of subdirectories of a given directory? would i
>just use the same method as if i were listing files?
you can use opendir/readdir/closedir to read the directory and the -d file
test (see the perlfunc man page in recent perl distributions) of the
directory entries returned, or you can try the File::Find module if you
like.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Wed, 04 Mar 1998 00:55:21 GMT
From: drummj@mail.mmc.org (Jeffrey Drumm)
Subject: Re: Summing Up Array Values - How Do I?
Message-Id: <34fca14d.181465577@news.mmc.org>
On 3 Mar 1998 21:36:32 GMT, cberry@cinenet.net (Craig Berry) wrote:
>Uri Guttman (uri@sysarch.com) wrote:
>: let's go schwartzian on the newbie!
>:
>: @yards = (2,3);
>: $sum = 0 ;
>: map { $sum += $_ } @yards ;
>
>Thou shalt not use map in a void context! :)
<snip>
Why not? If it truly was a BAD THING (at least in LW's mind), wouldn't -w
catch it?
After all, we use chomp() in a void context all the time. ;-)
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center Information Services
420 Cumberland Ave, Portland, ME 04101
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented." -me
------------------------------
Date: 3 Mar 1998 19:38:25 -0600
From: jima@MCS.COM (Jim Allenspach)
Subject: Re: Summing Up Array Values - How Do I?
Message-Id: <6dibah$ci@Mars.mcs.net>
>>Uri Guttman (uri@sysarch.com) wrote:
>>: let's go schwartzian on the newbie!
>>:
>>: @yards = (2,3);
>>: $sum = 0 ;
>>: map { $sum += $_ } @yards ;
Not to pit-nick or anything, but "Schwartzian" would imply a
map-sort-map execution. Using just a map is, well, just a map.
>>Thou shalt not use map in a void context! :)
><snip>
>Why not?
Because it needlessly builds up a meaningless array (in this case,
the successive values of $sum), and then discards it. Not a great loss if
we're just talking a few items in an array, but pretty bad if your list of
values gets big. Best not to fall into a habit of doing it. Performance and
memory issues, that sort of rot.
> If it truly was a BAD THING (at least in LW's mind), wouldn't -w
>catch it?
Hey, there's a LOT of stuff that -w doesn't catch that most sane(?)
programmers wouldn't dare write. Can't pick it ALL up, ya know.
>After all, we use chomp() in a void context all the time. ;-)
Well, chomp just returns a number (# of chars deleted). Not as much
overhead as building up a (potentially) hyooge array.
jma
--
jima at mcs dot com
Chicago, IL Perl programmers do it
http://www.streams.com/jima/ with one hump.
------------------------------
Date: 03 Mar 1998 21:38:47 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Summing Up Array Values - How Do I?
Message-Id: <x7zpj7xjrc.fsf@sysarch.com>
jima@MCS.COM (Jim Allenspach) writes:
> >>Uri Guttman (uri@sysarch.com) wrote:
> >>: let's go schwartzian on the newbie!
> >>:
> >>: @yards = (2,3);
> >>: $sum = 0 ;
> >>: map { $sum += $_ } @yards ;
>
> Not to pit-nick or anything, but "Schwartzian" would imply a
> map-sort-map execution. Using just a map is, well, just a map.
i admit that is true. i was just foolin' around with the array sum
request. i never would use map that way in anything i write.
--
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 01:06:33 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: The -w switch (was Re: better way to do this?)
Message-Id: <6di9ep$kdk$2@client3.news.psi.net>
Jon Drukman (jsd@hudsucker.gamespot.com) wrote on 1645 September 1993 in
<URL: news:6dhru6$hdk$1@its.hooked.net>:
++ Uri Guttman <uri@sysarch.com> wrote:
++ : i don't call it a production program or module
++ : if it doesn't work under -w and usually use strict.
++
++ just to pick nits...
++
++ note that the book "effective perl programming" by joseph hall and
++ randal schwartz 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.)
I read that too, and I disagree. As for the speed hit, I hardly believe
the hit is significant (show me extended Benchmark results to prove me
wrong). And if an insignificant speed hit is important for your users,
you probably shouldn't write Perl anyway.
I very much prefer a useful error message than a "it produced the wrong
results" report from the users.
Abigail
--
perl -wle 'print "Prime" if (0 x shift) !~ m 0^\0?$|^(\0\0+?)\1+$0'
------------------------------
Date: 4 Mar 1998 01:30:28 GMT
From: Zenin <zenin@best.com>
Subject: Re: The -w switch (was Re: better way to do this?)
Message-Id: <888975369.5442@thrush.omix.com>
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
"Invalid headers". Thus, leaving -w in CGI code can make any
future upgrades impossible because the risk of breaking every CGI
on the site is to great. This isn't just CGI either, as filling
root's mailbox with warning messages from scripts run in it's
crontab isn't a Good Thing either.
I had this happen on a client's server (5.004 to 5.00401 I think it
was?). The *entire* website (%90 dynamic content) basically ground
to a halt. We had to do a lot of fast talking and a quick reinstall
of 5.004 to not lose the client over it...
When the p5p declare to never add another warning type or condition
I'll change my stance. Until then, I'll nuke that -w from all
production code that has the slightest chance of causing problems.
--
-Zenin
zenin@best.com
------------------------------
Date: 4 Mar 1998 01:33:28 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: What is PERL? Learn JAVA instead?
Message-Id: <6dib18$kva$1@client3.news.psi.net>
Brian Slone (bslone@earthlink.net) wrote on 1645 September 1993 in
<URL: news:34FC5A59.5F2EB29D@earthlink.net>:
++ I really don't know crap about PERL.
Then read a book. Or manuals.
++ How is it different from JAVA?
Java is proprietary, Perl is open. Java is a bondage programming
language forcing *you* to dance to its tune; Perl can be bended
in any way you want.
Here is what some other people said:
Yes: Java's main advantage over Perl is that it's hard to use for casual
programmers, so keeps all but the most intrepid programmers away from it.
It has no decent support for string processing, allowing you to spend
hours at useless debugging. It has a very restrictive and static system
to make sure you don't try anything interesting. It makes sure that you
use objects, by golly, because James Gosling said so. It's easy for C++
programmers to use, and hard for shell or BASIC programmers to use. It
also only runs on a few systems, locking its customers into a a closed
system and restricting their options.
[Tom Christiansen in `Java Vs. Perl'
<news:53k0v7$a36$1@csnews.cs.colorado.edu>]
Java is cute. Perl is practical.
[Nathan V Patwardhan in `Java Vs. Perl'
<news:53lq5i$svc@prometheus.acsu.buffalo.edu>]
I can do this because Perl lays down like a wanton woman and lets me
have my way with her.
[Geoff Gerrietts in `nascent FMTEYWTK on OO Perl vs C++']
Of course, this being Perl, we could always take both approaches.
[Larry Wall in `sub attributes'
<199709021744.KAA12428@wall.org>, 2 Sep 1997]
But the possibility of abuse may be a good reason for leaving
capabilities out of other computer languages, it's not a good reason
for leaving capabilities out of Perl.
[Larry Wall in `Macros'. {perl5-porters}
<199709251614.JAA15718@wall.org> 25 Sep 1997]
Let be clear: Java is platform-independent to some extent (I mean, you
need similar hardware, 256-color graphics, etc for just about every
'plaform' JDK 1.1 works on), but IT IS NOT OPEN. It is proprietary Sun
technology. I am not trying to shift the argument, but I want that on
the record since we are constantly getting beaten up on what is open vs.
closed.
[Thomas Reardon in `Latest Java hole is Netscape/Sun only'
<199703092311.SAA02191@ns2.rutgers.edu>]
I don't know - most books on Java at least present a lot of
good reasons to learn Perl.
[David Alan Black in `What's a bad Perl book?'
<news:5h99fc$m39@pirate.shu.edu>]
Futhermore, Perl is *much*, *much* simpler than Java. Consider
the simplest possible Java program, as given in one of O'Reilly's books:
Example 1-1 shows the simplest possible Java program: "Hello World".
Example 1-1: Hello World
public class HelloWorld {
public static void main (String[] args) {
System.out.println ("Hello World!");
}
}
[David Flanagan in `Java in a Nutshell',
O'Reilly, 1996. p 10.]
Pardon? Nesting 5 deep to print a line? And you need a separate
compiling step too? Compare:
perl -wle 'print "Hello World!"'
++ Which one is better?
That depends on your definition of better. While I find Perl better
for some reason than Java, someone else might find Java better for
exactly the same reason.
++ What can I use it for?
Anything but ironing your shirt. But who knows what 5.006 is going
to do for you.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
------------------------------
Date: 4 Mar 1998 02:26:35 GMT
From: Zenin <zenin@best.com>
Subject: Re: What is PERL? Learn JAVA instead?
Message-Id: <888978736.262623@thrush.omix.com>
John Guisson <mrpc1@hotmail.com> wrote:
: java is young and has some setbacks,
s/some/major/g;
: but at the same time it is a very promising language.
s/promising/disappointing/g;
: 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.
: lightweightness,
HEHEHEHEHE...hold on, I need to stop laughing... You kill me, you
really do. :-)
: object-oriented capabilities,
You say that like it's a Good Thing[tm], it's not. Java is OOO
(Overly Object Oriented), not OO and far too many "programmers"
love the brain dead idea that every single field needs a set and
get method and should only ever be accessed by them.
: and ease of use.
Hehehehe...I need to stop laughing again. :-)
: java's main cons are
...everything you listed as "advantages" plus...
: that it is immature, and it is (for now at least) VEEEERYYYY
: SLOOOOOWWWWWW...
This really depends. Java isn't as slow as people make it
out to be. It's brain dead programmers mostly. As with most
languages, design and algorithm play a much larger part then
the language itself. I've seen some vary slow Java applications,
but most of the time when I actually look under the hood at
the code it's often vary clear where all the CPU/IO time was
wasted.
Good programmers write good code. Bad programmers write trash.
: > : What can I use it for?
Nuclear missile guidance systems. That's what Perl was build for,
and it's the only thing that it's really good at building. :-P
What kind of question is this...?
: i'd suggest perl for anything that does not require multi-media
You'll have to define "multi-media". Is text with pictures
"multi-media"? Are you just displaying the images/sounds/whatever
or are you actively trying to edit them? Perl (with help from C
and Tk) does a nice job of working with images and GUIs, and it's
vary easy (on Unix systems anyway) to call sound apps to play your
sound files, if not simply pipe them to the device directly.
: and goes on the web.
Further pushing the myth that Perl is only good for Web use. :-/
: java isn't a toy language anymore, but it is somewhat limited. java can
: be used for stand-alone database applications and
: anything that has to do with networks and sockets.
Ditto for Perl, and much easier, faster and more reliably. Perl/Tk
with DBI can make *vary* powerful GUI database applications in
a minimal about of time and with much more reliability.
: but again, it is slowww.
Brain numbingly so... :-/
: before producing a major app in it, wait for java 1.2.
Too late... :-)
--
-Zenin
zenin@best.com
------------------------------
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 2015
**************************************