[16729] in Perl-Users-Digest
Perl-Users Digest, Issue: 4141 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 26 21:05:25 2000
Date: Sat, 26 Aug 2000 18:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <967338309-v9-i4141@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 26 Aug 2000 Volume: 9 Number: 4141
Today's topics:
Re: ActivePerl output to my browser? <mikecook@cigarpool.com>
clearing a file <mikecook@cigarpool.com>
Re: clearing a file (Greg Bacon)
Combining Strings <jpalley@jps.net>
Re: Combining Strings <jpalley@jps.net>
DBM Trouble 08/26/00 invinfo@my-deja.com
Re: fortunes.tar.gz: where can I get it? <gellyfish@gellyfish.com>
glob failed (child exited with status 126) migres@my-deja.com
Re: Good companion book to Programming Perl? <slipgun@desertsnake.abelgratis.com>
Re: Good companion book to Programming Perl? (Avast)
hard reference to subroutines from a hash variable <lds@i-55.com>
Re: hard reference to subroutines from a hash variable <jhelman@wsb.com>
Re: Kill Me! <timewarp@shentel.net>
Re: Kill Me! (Tony L. Svanstrom)
Re: Kill Me! <flavell@mail.cern.ch>
More trouble with my favorite Perl module. (P::RD) <ocschwar@mit.edu>
Re: More trouble with my favorite Perl module. (P::RD) <ocschwar@mit.edu>
Re: Newbie - Errors causing download of file! <superman183@hotmail.com>
Read and Write in same session <jpalley@jps.net>
Re: reading and writing file contents (Jakob Schmidt)
Re: Stumped by Reg Exp Problem - help?? (Daniel Chetlin)
Why does while(<>) not localize $_? (Daniel Chetlin)
Re: would you recommend buying a book (Daniel Chetlin)
Re: would you recommend buying a book <uri@sysarch.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 26 Aug 2000 15:23:19 -0700
From: "Michael Cook" <mikecook@cigarpool.com>
Subject: Re: ActivePerl output to my browser?
Message-Id: <PsXp5.998$83.324018@news.uswest.net>
I have successfully ran Active Perl with IIS & iPlanet fast track on an NT
box & am sure it would work just fine with 98. The catch (for IIS) is to
have IIS running before installing Active Perl & the catch (for iPlanet) is
to use shellcgi instead of defining a cgi-bin.
Michael
"Charles Betman" <cbetman@raketnet.nl> wrote in message
news:HhI9oW5DAHA.308@asd24-aux-005.tis.telfort.net...
> Hi there,
>
> I've installed ActivePerl on my Wintel machine (Windows 98) and it's no
> problem to run my cgi-scripts in a Dos-box.
> What I want is to test my scripts (from by browser) and send the output
back
> to my browser. Can anybody please tell me if that's possible and if so,
how?
>
> Thanks in advance.
>
> --
> Met vriendelijke groet,
> Charles
> http://www.betman.demon.nl/
> charles@betman.demon.nl
>
>
------------------------------
Date: Sat, 26 Aug 2000 15:24:44 -0700
From: "Michael Cook" <mikecook@cigarpool.com>
Subject: clearing a file
Message-Id: <QsXp5.999$83.323995@news.uswest.net>
Hi folks,
I have been using this:
open (TEMP, ">db/members.tmp") || die("Unable to open db/members.tmp");
flock(TEMP, $LOCK_EX);
print TEMP $null;
flock(TEMP, $LOCK_UN);
close (TEMP);
to clear a file - is there a better way (I would like results similar to
using cat /dev/null > file) at the command line?
Thanks,
Michael
--
== CigarPool ==
http://www.cigarpool.com
------------------------------
Date: Sat, 26 Aug 2000 23:15:21 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: clearing a file
Message-Id: <sqgjs979t9151@corp.supernews.com>
In article <QsXp5.999$83.323995@news.uswest.net>,
Michael Cook <mikecook@cigarpool.com> wrote:
: I have been using this:
:
: open (TEMP, ">db/members.tmp") || die("Unable to open db/members.tmp");
: flock(TEMP, $LOCK_EX);
: print TEMP $null;
: flock(TEMP, $LOCK_UN);
: close (TEMP);
:
: to clear a file - is there a better way (I would like results similar to
: using cat /dev/null > file) at the command line?
Opening the file for writing will clobber/clear/truncate it. Perl also
has a truncate() operator for files.
Greg
--
I'm sorry, Dave, but that's a feature.
-- Larry Wall in <200001261652.IAA02866@kiev.wall.org>
------------------------------
Date: Sat, 26 Aug 2000 15:46:29 -0700
From: Jonathan Palley <jpalley@jps.net>
Subject: Combining Strings
Message-Id: <39A848C5.F774DC55@jps.net>
Oh, this has to be sooooooo obvious, except i can't seem to find it
anywhere
How do i combine two string.....for instance, in Visual Basic, you would
use
Dim S1 as String, S2 as String, S3 as String
S2 = "Hello "
S3 = "World"
S1 = S2 & S3 'How do i do this part in perl?
Print S1 'This would Print 'Hello World'
Except i can't figure out how to do this in PERL
Thanx for the help!
JP
------------------------------
Date: Sat, 26 Aug 2000 15:53:10 -0700
From: Jonathan Palley <jpalley@jps.net>
Subject: Re: Combining Strings
Message-Id: <39A84A56.C189141B@jps.net>
Just as I speak, i figure it out.......you use a . (dot)
$S1 = $S2 . $S3;
someone correct me if i'm wrong!
Jonathan Palley wrote:
> Oh, this has to be sooooooo obvious, except i can't seem to find it
> anywhere
>
> How do i combine two string.....for instance, in Visual Basic, you would
> use
> Dim S1 as String, S2 as String, S3 as String
> S2 = "Hello "
> S3 = "World"
> S1 = S2 & S3 'How do i do this part in perl?
> Print S1 'This would Print 'Hello World'
>
> Except i can't figure out how to do this in PERL
>
> Thanx for the help!
>
> JP
------------------------------
Date: Sun, 27 Aug 2000 00:35:47 GMT
From: invinfo@my-deja.com
Subject: DBM Trouble 08/26/00
Message-Id: <8o9np3$pv3$1@nnrp1.deja.com>
Why am I having so much trouble with DBM files ???
While it looks so easy in many of the perl books,
I'm having a really rough time figuring out the exact syntax,
for the various versions.
The basic premise is that I can grab some stuff off of a HTML form,
use as the key the User's email, Delimit everything else with a ":"
or double-colon and go to town, using the data.
Has anyone else experienced problems with DBM's ?
I'm actually convinced that there very few people using this,
since there are more user friendly Web apps available.
code snippet:
Why am I having so much trouble with DBM files ???
While it looks so easy in many of the perl books,
I'm having a really rough time figuring out the exact syntax,
for the various versions.
The basic premise is that I can grab some stuff off of a HTML form,
use as the key the User's email, Delimit everything else with a ":"
or double-colon and go to town, using the data.
Has anyone else experienced problems with DBM's ?
I'm actually convinced that there very few people using this,
since there are more user friendly Web apps available.
code snippet:
use strict;
use Fcntl;
use NDBM_File;
# use DB_File;
use POSIX;
tie %FH, 'NDBM_File', $df, O_RDONLY, 0666;
while ( ($k, $v) = each %FH )
{
Suggestions Welcome -RJK
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 26 Aug 2000 12:14:12 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: fortunes.tar.gz: where can I get it?
Message-Id: <8o88q4$17p$1@orpheus.gellyfish.com>
On Fri, 25 Aug 2000 13:07:59 GMT Michael Wang wrote:
> The link on Perl Power Tool does not have public permission,
> so where can I get fortunes.tar.gz? Email reply is also
> welcome. Thanks.
The fortune files should come with the source for the C version of 'fortune'
which you can probably get from your nearest sunsite mirror. There are
a number of alternate sets available that you will be able to find via
Freshmeat <http://freshmeat.net>
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: Sat, 26 Aug 2000 22:09:19 GMT
From: migres@my-deja.com
Subject: glob failed (child exited with status 126)
Message-Id: <8o9f64$h2u$1@nnrp1.deja.com>
Hi,
I have a problem that I cannot figure out. I purchased not long ago a
Pentium III computer with an 8 GB ATA/66 hard disk. I installed the
ZipSlack distribution which I had in another computer before (a Pentium
II). I tried to run some Perl programs I had written and used many
times in the previous machine and they don't work. They bail out and
say: glob failed (child exited with status 126). The line in question
says this:
for $file (<*.f>) {
`cat $file`
}
This works fine in Perl on DOS and it used to work with the other
computer and zipslack. What's going on? the kernel it uses is 2.0.37,
and
of course it uses the UMSDOS file system. I am using an "old" kernel
because of the known issues of UMSDOS on the 2.2.x series of
kernels.
What's going on? any help will be appreciated.
Regards,
Miguel Restrepo
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 26 Aug 2000 23:49:32 +0000
From: Slip Gun <slipgun@desertsnake.abelgratis.com>
Subject: Re: Good companion book to Programming Perl?
Message-Id: <39A8578C.6A293BE6@desertsnake.abelgratis.com>
Greg Bacon wrote:
>
> In article <39A82E82.FB76B00C@desertsnake.abelgratis.com>,
> Slip Gun <slipgun@desertsnake.abelgratis.com> wrote:
>
> : I have just bought a copy of the 3rd edition of Larry Wall + co's
> : "Programming Perl", and although it is a v.good book, it is more of a
> : reference book than a learning one. I am considering buying "The Perl
> : Cookbook" as a companion - is this a good idea? I have heard that
> : together, these books are great for learning perl.
>
> You didn't talk much about your background. If you have a CS background
> or even less formal programming experience, Nigel Chapman's book,
> _Perl: The Programmer's Companion_[*] is an excellent choice.
>
> [*] <URL:http://catalog2.wiley.com/catalog/titleinfo/1,1812,047197563X|840|01,00.html>
>
> Greg
> --
> Convictions are more dangerous enemies of truth than lies.
> -- Nietzsche
Sorry. I have a pretty thorough knowledge of QuickBasic which I learned
on an old 386, and a bit of javascript and assembler. No experience in
C/C++ or Java, however.
I know it's not much, but every little bit helps :-)
Cheers,
Ed
--
Those who trade away their privacy in favour of security will soon find
that they have neither.
------------------------------
Date: Sat, 26 Aug 2000 22:51:57 GMT
From: avast@hortonsbay.com (Avast)
Subject: Re: Good companion book to Programming Perl?
Message-Id: <39a8493c.12885914@news.accesstoledo.com>
<slipgun@desertsnake.abelgratis.com> wrote:
>Hi,
>I have just bought a copy of the 3rd edition of Larry Wall + co's
>"Programming Perl", and although it is a v.good book, it is more of a
>reference book than a learning one.
You are correct, sir. Altho this new edition seems a log better than
the 2nd edition which I found was not really suited for learning Perl.
O'Reilly's "Learning Perl" is quite good for learning Perl altho it
does not provide the spells for deeper juju.
> I am considering buying "The Perl Cookbook" as a companion - is this a good idea? I have heard that
>together, these books are great for learning perl.
Good idea. I love the Cookbook; I use it a LOT.
Avasr
------------------------------
Date: Sat, 26 Aug 2000 18:40:11 -0700
From: "lds" <lds@i-55.com>
Subject: hard reference to subroutines from a hash variable
Message-Id: <qGYp5.80000$dC1.118991@dfw-read.news.verio.net>
I'm very very new to perl. I do have a copy of the camel book, however i
just ca't figure this out. Would someone comment on whether or not this
would work:
$user_data{time_at_post} = \&time_now
------------------------------
Date: Sat, 26 Aug 2000 23:52:03 GMT
From: Jeff Helman <jhelman@wsb.com>
Subject: Re: hard reference to subroutines from a hash variable
Message-Id: <39A85899.EC80F638@wsb.com>
lds wrote:
>
> I'm very very new to perl. I do have a copy of the camel book, however i
> just ca't figure this out. Would someone comment on whether or not this
> would work:
>
> $user_data{time_at_post} = \&time_now
Yes, that will work (if you add a semicolon to the end of the line).
The question is, what do you want to do with it?
JH
------------------------------
Date: Sat, 26 Aug 2000 18:04:27 -0400
From: Albert Dewey <timewarp@shentel.net>
Subject: Re: Kill Me!
Message-Id: <39A83EEA.2B9627E1@shentel.net>
Tony -
# I will continue to answer other's posts 'Jeopardy Style'.
# I will answer off topic questions if I really believe that I can help
that person with an answer that is Perl related or even combining Perl
with other solutions.
# I will not flame other people with worthless masturbatory replies.
# I won't criticize people for posting Newbie Questions other than
suggest that they get a good book on Perl to help them in their quest to
learn Perl.
# I won't answer people's questions with snippets of a solution that are
clearly over the poster's head in an effort to razzle dazzle that person
with my sheer brilliance.
# I won't even criticize people such as yourselves when you post after
the quoted content.
I would like to see this charter. Since you are so damn sure of yourself -
point me to it and show me a SINGLE place in it where my comments above are
in violation of your so called charter - I'll bet you can't! Or maybe you
just aren't up to the challenge.
As they say - "Put up or shut-up!"
Albert Dewey
"Tony L. Svanstrom" wrote:
> That's a list of things that are against what's ok acording to the
> charter; since this is a "semi-moderated" I'm hoping that the killfiling
> will be at that end instead, since that's where it should be taken care
> of in this case.
------------------------------
Date: Sun, 27 Aug 2000 00:34:47 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: Kill Me!
Message-Id: <1efzyk6.1olwrqeof3hxcN%tony@svanstrom.com>
Albert Dewey <timewarp@shentel.net> wrote:
> "Tony L. Svanstrom" wrote:
>
> > That's a list of things that are against what's ok acording to the
> > charter; since this is a "semi-moderated" I'm hoping that the killfiling
> > will be at that end instead, since that's where it should be taken care
> > of in this case.
> # I will continue to answer other's posts 'Jeopardy Style'.
> # I will answer off topic questions if I really believe that I can help
> that person with an answer that is Perl related or even combining Perl
> with other solutions.
> # I will not flame other people with worthless masturbatory replies.
> # I won't criticize people for posting Newbie Questions other than
> suggest that they get a good book on Perl to help them in their quest to
> learn Perl.
> # I won't answer people's questions with snippets of a solution that are
> clearly over the poster's head in an effort to razzle dazzle that person
> with my sheer brilliance.
> # I won't even criticize people such as yourselves when you post after
> the quoted content.
>
> I would like to see this charter. Since you are so damn sure of yourself -
> point me to it and show me a SINGLE place in it where my comments above are
> in violation of your so called charter
I don't have to bother with that, because the netiquette belongs to the
set of rules that any NG uses... So 'Jeopardy Style' is wrong, OT
postings are wrong...
/Tony
--
/\___/\ Who would you like to read your messages today? /\___/\
\_@ @_/ Protect your privacy: <http://www.pgpi.com/> \_@ @_/
--oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
on the verge of frenzy - i think my mask of sanity is about to slip
---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
\O/ \O/ ©99-00 <http://www.svanstrom.com/?ref=news> \O/ \O/
------------------------------
Date: Sun, 27 Aug 2000 01:46:51 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Kill Me!
Message-Id: <Pine.GHP.4.21.0008270145070.23063-100000@hpplus03.cern.ch>
On Sat, 26 Aug 2000, Albert Dewey wrote:
> Kill Me!
Gladly. It ws already on my to-do list based on your previous
behaviour.
------------------------------
Date: Sat, 26 Aug 2000 19:15:59 -0400
From: Omri Schwarz <ocschwar@mit.edu>
Subject: More trouble with my favorite Perl module. (P::RD)
Message-Id: <39A84FAF.81D85D75@mit.edu>
I have a rule that goes like this:
primary_expression :
'(' expression
{
if ($item{expression} =~ /sqrt/)
{
print STDERR "\nBing! $item{expression}\n";
print STDERR "$text\n$thisoffset\n$thiscolumn\n";
1;
}
}
')'
{
if ($return =~ /sqrt/) {
print STDERR "Bong! $return\n";
}
1;
}
As you can see, the print statements there are to diagnose
why cases of this primary expression aren't succeeding.
When I run it on the expression "(-1+sqrt(1+4*n*(n+1)*eta[j]/eps[j]))/2"
the printout I get is this:
Bing! -1 plus the function sqrt as applied to the argument '1 plus 4
times n times the parenthetical expression n plus 1 now times array
eta's element at address (j) divided by array eps's element at address
(j)'
(1+4*n*(n+1)*eta[j]/eps[j]))/2;
}
And no Bong. (Cheaper than booze, safer than pills,
but none for me, it seems.)
As you can see, not enough of $text is getting chomped compared to
what is being parsed.
The rule for a function call is :
postfix_expression :
primary_expression[context => $arg{context}]
{
# must be global. use stack to prevent disasters.
push @basics, $basic;
$basic = $item{primary_expression};
$add_on = 0 ;
if ($arg{context} eq 'assignment_expression') {
$return = 'variable ' . $item{primary_expression};
} else {
$return = $item{primary_expression};
}
if ($return =~ /sqrt/) {
print STDERR " postfix $return\n";
}
}
(# function call
'('
argument_expression_list #needs $return!
')'
{
$return = $item{argument_expression_list};
}
)(?)
{
my $args = join('',@{$item[-1]});
if ($args) {
#print STDERR "\nfunction $args\n";
$return = '';
if ($arg{context} eq 'statement') {
$return = "Perform ";
}
$return .= "the function $basic";
if ($args) {
$return .= " as applied to the argument$args";
}
if ($arg{context} eq 'statement') {
$return .= ".\n";
}
}
}
Now, the ()(?) part succeeds, or else we wouldn't get the printout the
way
we do, and yet something goes unconsumed.
I'm unsure why, and so would like any hint available.
Regards,
Omri
( whole thing is at http://www.mit.edu/~ocschwar/decss2.pl )
------------------------------
Date: Sat, 26 Aug 2000 19:31:44 -0400
From: Omri Schwarz <ocschwar@mit.edu>
Subject: Re: More trouble with my favorite Perl module. (P::RD)
Message-Id: <39A85360.5FCE5612@mit.edu>
Omri Schwarz wrote:
Wow!
Switching from 1.78 to 1.79 solved that problem.
------------------------------
Date: Sat, 26 Aug 2000 19:37:40 -0400
From: "Dave" <superman183@hotmail.com>
Subject: Re: Newbie - Errors causing download of file!
Message-Id: <39a855fa_4@news1.prserv.net>
I'm guessing a little bit, but when you're erroring then possibly the Perl
script is "printing" a message to standard ouput (or trying to), to indicate
the error - maybe this is screwing up the content header and getting your
server to do strange things. Have a look at the script to see if there are
any print statements that would happen on an error.....(and rem them
out).....
That's just my attempt at being helpful, and haven't got a unique insight on
the prob at hand....but may be worth a try....
Good luck,
Dave
scottfreez@my-deja.com wrote in message <8o6j5i$e6v$1@nnrp1.deja.com>...
>I'm working on a perl app which acts as a middelman between a bunch of
>tables and asp pages.
>
>The problem is this - sometimes when there is an error in the page,
>instead of dieing or displaying a message, the .pl file "conveniently"
>offers to download itself directly to my computer!! This is NOT good, as
>any user would then be able to view the perl source code...
>
>Does anyone know 1) WHY it is doing this, and 2) more importantly, how
>to avoid it?
>
>thanks
>scottfreez
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
------------------------------
Date: Sat, 26 Aug 2000 17:21:18 -0700
From: Jonathan Palley <jpalley@jps.net>
Subject: Read and Write in same session
Message-Id: <39A85EFE.F36D392D@jps.net>
Thanx for all the help you've given me for the last two Q's I've
asked....I'm new to PERL (know other languages).....so i'm trying to get
the stuff down.....
Alright, now my question is, is there a way to read and write to a file
in the same session......sure i can open, read, close, open, write,
close.....but it seems redundant.
------------------------------
Date: Sun, 27 Aug 2000 00:11:41 +0200
From: sumus@aut.dk (Jakob Schmidt)
Subject: Re: reading and writing file contents
Message-Id: <1efzxhg.15uvq59cchg0oN@[192.168.88.117]>
Sundar <sdoraira@vt.edu> wrote:
> $data = <datk>; # could this line be the problem?
Yes - if you want to slurp the entire fil you need an array for the
lines (or the $/ trick which you'll learn about reading the docs).
You could go
@data = <datk>
and change this
> print logs $data; # write contents of log #
to
print logs @data;
Also you could avoid the variable altogether thus:
# Print Sheet
open LOGS,">$stat" or die "Couldn't open stat: $!";
print LOGS "write some HTML";
open DATK, "$log" or die "Couldn't open log: $!";
print LOGS <DATK>; # write contents of log #
close DATK;
print LOGS "write some more HTML";
close LOGS;
Note: I added checks for the opens (important), uppercased your
filehandles (to comply with convention) and removed some parens which
desturbed my Perly eye (a matter of taste mainly).
------------------------------
Date: Sat, 26 Aug 2000 23:42:40 GMT
From: daniel@chetlin.com (Daniel Chetlin)
Subject: Re: Stumped by Reg Exp Problem - help??
Message-Id: <QBYp5.7712$C7.228515@news-west.usenetserver.com>
On 26 Aug 2000 03:32:04 GMT, Eli the Bearded <elijah@workspot.net> wrote:
>In comp.lang.perl.misc, jason <elephant@squirrelgroup.com> wrote:
>> Eli the Bearded <elijah@workspot.net> wrote ..
>> >I was under the impression that this was not an HTML document.
>> >I don't want to think what kind of breakage HTML::Parser could
>> >do to non-HTML documents. (Imagine an news or email followup
>> >where the author used '<' instead of '>' to quote lines.)
>>
>> but the originator specifically said that some of the URLs are already
>> contained within anchor tags .. that would suggest that it's an HTML
>> document
>
>It suggests to me that he is writing a filter, which may
>sometimes be used for HTML and may sometimes be used for something else.
>
>It might be my bias spoeaking, but the things
>that often come to my mind for this sort of thing
>are Usenet Posts, Email, and random <TEXTARA> content.
>(Although accepting HTML in <TEXTAREA>s is a bad idea.)
>
>Elijah
>------
>has seen html used in .sigs of plain text posts
HTML::Parser should be able to handle any of these. He just asked to not make
the substitution on anything inside of an <a> element.
This is not particularly well tested, but it seems to work.
use HTML::Parser;
sub default_h { print my_substitution(shift) };
sub find_a {
print my_substitution($_[2]) if $_[0] ne "a";
my $self = $_[1];
$self->handler(default => sub { print shift }, "text");
$self->handler(end => sub { shift->handler(default => \&default_h);
print shift; },
"self,text" );
print $_[2];
}
sub my_substitution {
### Anything you want to do to the text goes here
### For example, Eli's s/// to find and replace URLs
$_[0] =~ s/foo/bar/g;
return $_[0];
}
$p = HTML::Parser->new(api_version => 3);
$p->handler(default => \&default_h, "text");
$p->handler(start => \&find_a, "tagname,self,text");
while (<DATA>) {
$p->parse($_);
$p->eof;
}
__DATA__
this is a foo test
this is a foo test, with some <foo> markup
this is a foo test, with an <a href="foo">tag</a>
this is a foo test, with an <a href="foo">tag with a foo</a>
what happens if we try to <<<<<< confuse HTML::Parser?
how about like <a href="foo> this?
------------------------------
Date: Sun, 27 Aug 2000 00:38:21 GMT
From: daniel@chetlin.com (Daniel Chetlin)
Subject: Why does while(<>) not localize $_?
Message-Id: <1qZp5.7988$C7.241215@news-west.usenetserver.com>
[~/dev/bleadperl] $ ./perl -l
for (qw/foo bar baz/) {
print;
for (qw/foo bar baz/) {
print "\t$_";
}
}
__END__
foo
foo
bar
baz
bar
foo
bar
baz
baz
foo
bar
baz
#####
[~/dev/bleadperl] $ ./perl -l
for (qw/foo bar baz/) {
print;
while (<>) {
print "\t$_";
}
}
__END__
foo
Modification of a read-only value attempted at - line 3.
#####
[~/dev/bleadperl] $ ./perl -MO=Deparse
for (qw/foo bar baz/) {
print;
while (<>) {
print "\t$_";
}
}
__END__
foreach $_ ('foo', 'bar', 'baz') {
print $_;
while (defined($_ = <ARGV>)) {
print "\t$_";
}
}
- syntax OK
#####
Why not 'while (defined(local $_ = <ARGV>))'? Those familiar with the
localizing behavior of foreach won't be surprised that the while(<>) magic
doesn't do the same.
I searched xray and the bug DB and found nothing, but to be honest I don't get
along with xray's search engine very well. There's probably a pretty good
reason, I just haven't heard it yet.
-dlc
------------------------------
Date: Sun, 27 Aug 2000 00:07:04 GMT
From: daniel@chetlin.com (Daniel Chetlin)
Subject: Re: would you recommend buying a book
Message-Id: <IYYp5.7822$C7.236330@news-west.usenetserver.com>
On Sat, 26 Aug 2000 19:18:47 GMT, Tim Hammerquist <tim@degree.ath.cx> wrote:
>Abigail <abigail@foad.org> wrote:
>> Tim Hammerquist (tim@degree.ath.cx) wrote on MMDXLIX September MCMXCIII
>> in <URL:news:slrn8q7gf8.66a.tim@degree.ath.cx>:
>> {}
>> {} Book advice: If it's published by O'Reilly and includes Perl in the
>> {} title, it's worth the money.
>>
>> Cargo cult. It's one of the most idiotic advices I've heard.
>
>I don't want to insult Godzilla! or anything, but I've noticed a
>distinct similarity between the attitude and responses of our local
>troll and Miss. Abigail.
Godzilla would probably call you a misogynist at this point. Abigail won't
;-).
>I don't like to generalize my computer paraphernalia as much as I did
>above, but the above statement holds true to date (with the possible
>exceptions of the Learning Perl sub-category, and the addition of Damian
>Conway's Object Oriented Perl).
>
>The fact is, O'Reilly is an excellent publisher with excellent books.
>The fact that it's trendy (Cargo cult, in your language) may just be (in
>this case) an indicator of it's effectiveness.
Hmm. You snipped several paragraphs of Abigail's explaining the specific books
she _does_ like of O'Reilly's. Clearly she's not making the blanket statement
that O'Reilly books are valueless. She's simply objecting to your blanket
statement that all O'Reilly Perl books are good.
Here are some examples of not-so-good-in-my-opinion-O'Reilly-Perl-books:
o Perl in a Nutshell (this book is a mystery to me)
o Perl for SAs
o Advanced Perl Programming (had several decent chapters, but overall I found it
disappointing)
o Learning Perl (sadly outdated with better non-O'Reilly alternatives
available)
O'Reilly is probably the most reliable publisher of Perl books (with the
caveat that if Manning keeps up its good work, this might not be true), but
that certainly doesn't mean that all of their titles are worth having.
-dlc
------------------------------
Date: Sun, 27 Aug 2000 00:19:58 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: would you recommend buying a book
Message-Id: <x7em3bsggi.fsf@home.sysarch.com>
>>>>> "DC" == Daniel Chetlin <daniel@chetlin.com> writes:
DC> Here are some examples of not-so-good-in-my-opinion-O'Reilly-Perl-books:
DC> o Perl in a Nutshell (this book is a mystery to me)
agreed. it just fills in a title in the nutshell line. but some like it
for that.
DC> o Perl for SAs
haven't seen it yet. i will sometime soon.
DC> o Advanced Perl Programming (had several decent chapters, but overall I found it
DC> disappointing)
yep. a useful new book might cover advanced topics (xs, guts) and
related things.
DC> o Learning Perl (sadly outdated with better non-O'Reilly alternatives
DC> available)
elements and teach yourself in 24 hours i both like. i haven't seen
beginning perl yet.
DC> O'Reilly is probably the most reliable publisher of Perl books
DC> (with the caveat that if Manning keeps up its good work, this
DC> might not be true), but that certainly doesn't mean that all of
DC> their titles are worth having.
fer sher.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 4141
**************************************