[22903] in Perl-Users-Digest
Perl-Users Digest, Issue: 5123 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 15 00:06:15 2003
Date: Sat, 14 Jun 2003 21:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 14 Jun 2003 Volume: 10 Number: 5123
Today's topics:
add <br> to <FILE> request <ghostnr1@telia.com>
Re: add <br> to <FILE> request <ian@WINDOZEdigiserv.net>
Re: add <br> to <FILE> request <bdonlan@bd-home-comp.no-ip.org>
Re: add <br> to <FILE> request <bdonlan@bd-home-comp.no-ip.org>
Re: add <br> to <FILE> request <noreply@gunnar.cc>
Re: add <br> to <FILE> request <ian@WINDOZEdigiserv.net>
Re: add <br> to <FILE> request <ian@WINDOZEdigiserv.net>
Re: add <br> to <FILE> request <jasonp@panix.com>
Re: add <br> to <FILE> request (Tad McClellan)
Re: book <wksmith@optonline.net>
Re: die and exception over-stringification <joey@dragon.kitenet.net>
Re: die and exception over-stringification <grazz@pobox.com>
Distributed CGI script in taint mode <noreply@gunnar.cc>
Free gifts give away, limited quantity <zqmkxlwu@xpljwkvs.com>
Re: get data on socket problem (rdack)
howto stop win32 perl script running under "scheduled t (Mitchell Laks)
Re: howto stop win32 perl script running under "schedul <bwalton@rochester.rr.com>
Re: list commands query <notspam@spamfree.dud>
Re: list commands query (Sam Holden)
Re: list commands query (Tad McClellan)
Re: list commands query (Jay Tilton)
Re: list commands query <asu1@c-o-r-n-e-l-l.edu>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 15 Jun 2003 00:36:11 GMT
From: "GhostNr1" <ghostnr1@telia.com>
Subject: add <br> to <FILE> request
Message-Id: <%bPGa.11847$mU6.14624@newsb.telia.net>
I use this
open (FILE, "< ./files/$file_name") or print "Open file Failed - $! <br>";
print "$file_name <p>";
while (<FILE>) {
print <FILE>;
}
close (FILE) or print "Close file Failed - $! <br>";
to open the file and read from it. The problem is that it loop it without
find the end and make a break line, I load it into a webpage and need to set
<br> tags in the end of every line in the file. How can I do that?
thx
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.489 / Virus Database: 288 - Release Date: 6/10/2003
------------------------------
Date: Sun, 15 Jun 2003 00:47:41 GMT
From: "Ian.H [dS]" <ian@WINDOZEdigiserv.net>
Subject: Re: add <br> to <FILE> request
Message-Id: <1cgnevs6otqdlg14aaku604r9lpjfhq5kl@4ax.com>
Keywords: Remove WINDOZE to reply
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
Whilst lounging around on Sun, 15 Jun 2003 00:36:11 GMT, "GhostNr1"
<ghostnr1@telia.com> amazingly managed to produce the following with
their Etch-A-Sketch:
> I use this
> open (FILE, "< ./files/$file_name") or print "Open file Failed - $!
> <br>"; print "$file_name <p>";
> while (<FILE>) {
> print <FILE>;
> }
> close (FILE) or print "Close file Failed - $! <br>";
>
>
> to open the file and read from it. The problem is that it loop it
> without find the end and make a break line, I load it into a
> webpage and need to set <br> tags in the end of every line in the
> file. How can I do that? thx
while (<FILE>) {
print "$_\n";
}
>
>
> ---
Please correctly form your sig separator.
[dash][dash][space]
Thank you.
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.489 / Virus Database: 288 - Release Date: 6/10/2003
>
uGH! More of this complete bollox.. You cannot prove this statement..
and it serves absolutely no purpose other than a free advert.. does
it make your penis swell when you see it? [sigh]
Regards,
Ian
-----BEGIN xxx SIGNATURE-----
Version: PGP 8.0
iQA/AwUBPuvCGmfqtj251CDhEQJVTACg6psGBMf7h8Er7pYwjmH7hlxi2nIAnjTT
Symi72tXxkfpCckytWqWQMWn
=Mdxr
-----END PGP SIGNATURE-----
--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.
------------------------------
Date: Sat, 14 Jun 2003 21:29:52 -0400
From: "bd" <bdonlan@bd-home-comp.no-ip.org>
Subject: Re: add <br> to <FILE> request
Message-Id: <pan.2003.06.15.01.29.52.7469@bd-home-comp.no-ip.org>
On Sun, 15 Jun 2003 00:36:11 +0000, GhostNr1 wrote:
> I use this
> open (FILE, "< ./files/$file_name") or print "Open file Failed - $! <br>";
> print "$file_name <p>";
> while (<FILE>) {
> print <FILE>;
> }
> close (FILE) or print "Close file Failed - $! <br>";
>
>
> to open the file and read from it. The problem is that it loop it without
> find the end and make a break line, I load it into a webpage and need to set
> <br> tags in the end of every line in the file. How can I do that?
I don't understand. What is it you want? You've demonstrated use of print,
why not use that to add a <br>?
------------------------------
Date: Sat, 14 Jun 2003 21:32:28 -0400
From: "bd" <bdonlan@bd-home-comp.no-ip.org>
Subject: Re: add <br> to <FILE> request
Message-Id: <pan.2003.06.15.01.32.26.748960@bd-home-comp.no-ip.org>
On Sun, 15 Jun 2003 00:47:41 +0000, Ian.H [dS] wrote:
> Whilst lounging around on Sun, 15 Jun 2003 00:36:11 GMT, "GhostNr1"
> <ghostnr1@telia.com> amazingly managed to produce the following with
> their Etch-A-Sketch:
>
>> I use this
>> open (FILE, "< ./files/$file_name") or print "Open file Failed - $!
>> <br>"; print "$file_name <p>";
>> while (<FILE>) {
>> print <FILE>;
>> }
>> close (FILE) or print "Close file Failed - $! <br>";
>>
>>
>> to open the file and read from it. The problem is that it loop it
>> without find the end and make a break line, I load it into a
>> webpage and need to set <br> tags in the end of every line in the
>> file. How can I do that? thx
>
>
> while (<FILE>) {
> print "$_\n";
> }
HTML dosen't treat newlines specially :) He needs <br>s or <pre>.
------------------------------
Date: Sun, 15 Jun 2003 03:34:54 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: add <br> to <FILE> request
Message-Id: <bcgiim$h9imb$1@ID-184292.news.dfncis.de>
Ian.H [dS] wrote:
> GhostNr1 wrote:
>>
>>I load it into a webpage and need to set <br> tags ...
-------------------------------^^^^^^^^^^^^^^^^^^^^^
> while (<FILE>) {
> print "$_\n";
> }
$_ =~ s/$/<br>/ and print while <FH>;
(Ian, how about moving your attention from the sig to OP? ;-) )
/ Gunnar
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sun, 15 Jun 2003 01:40:28 GMT
From: "Ian.H [dS]" <ian@WINDOZEdigiserv.net>
Subject: Re: add <br> to <FILE> request
Message-Id: <8jjnevsjtoumkb7oo04shmjinhc4sdisb0@4ax.com>
Keywords: Remove WINDOZE to reply
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
Whilst lounging around on Sun, 15 Jun 2003 00:47:41 GMT, "Ian.H [dS]"
<ian@WINDOZEdigiserv.net> amazingly managed to produce the following
with their Etch-A-Sketch:
> while (<FILE>) {
> print "$_\n";
> }
Oops, that should be:
while (<FILE>) {
print "$_<br />\n";
}
Regards,
Ian
-----BEGIN xxx SIGNATURE-----
Version: PGP 8.0
iQA/AwUBPuvOi2fqtj251CDhEQL4qgCcDsGvYwj/dLvXc/dW+UVJm4y4sKUAoN5D
5YoJzg0Yc6gLzvJ5yCbI4fMS
=N8lP
-----END PGP SIGNATURE-----
--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.
------------------------------
Date: Sun, 15 Jun 2003 01:48:31 GMT
From: "Ian.H [dS]" <ian@WINDOZEdigiserv.net>
Subject: Re: add <br> to <FILE> request
Message-Id: <32knevs6vd167ktbvnjmnlupih92guliv2@4ax.com>
Keywords: Remove WINDOZE to reply
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
Whilst lounging around on Sun, 15 Jun 2003 03:34:54 +0200, Gunnar
Hjalmarsson <noreply@gunnar.cc> amazingly managed to produce the
following with their Etch-A-Sketch:
> Ian.H [dS] wrote:
> > GhostNr1 wrote:
> >>
> >>I load it into a webpage and need to set <br> tags ...
> -------------------------------^^^^^^^^^^^^^^^^^^^^^
>
> > while (<FILE>) {
> > print "$_\n";
> > }
>
> $_ =~ s/$/<br>/ and print while <FH>;
>
> (Ian, how about moving your attention from the sig to OP? ;-) )
>
> / Gunnar
Heh.. 02:48 currently in the UK.. has been a long day =)
Corrected a few minutes ago =)
Regards,
Ian
-----BEGIN xxx SIGNATURE-----
Version: PGP 8.0
iQA/AwUBPuvQbWfqtj251CDhEQKjzACgmOX12zqhmOqgEY4Pmr+TLMCGHNMAoJLo
kCDggqEtOBPWCFBdW+ZXU5YR
=P3v/
-----END PGP SIGNATURE-----
--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.
------------------------------
Date: Sat, 14 Jun 2003 21:50:45 -0400
From: Jason Parker-Burlingham <jasonp@panix.com>
Subject: Re: add <br> to <FILE> request
Message-Id: <877k7o6rd6.fsf@freezer.burling>
"GhostNr1" <ghostnr1@telia.com> writes:
> while (<FILE>) {
> print <FILE>;
> }
That's wrong. The while() loop reads from FILE and puts the result
into $_. You then read again inside the loop and print that line.
The effect is to print only every second line of the file, which
probably isn't what you want. Instead you want something like:
open (FILE, "< ./files/$file_name") or print "Open file Failed - $! <br>";
print "$file_name <p>";
while (<FILE>) {
print;
}
close (FILE) or print "Close file Failed - $! <br>";
As regards your actual question, it's not clear what you want to do.
--
Stay up-to-date on what I'm doing lately:
http://www.panix.com/~jasonp
------------------------------
Date: Sat, 14 Jun 2003 21:21:41 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: add <br> to <FILE> request
Message-Id: <slrnbenm1l.92o.tadmc@magna.augustmail.com>
Jason Parker-Burlingham <jasonp@panix.com> wrote:
> "GhostNr1" <ghostnr1@telia.com> writes:
>
>> while (<FILE>) {
>> print <FILE>;
>> }
>
> That's wrong. The while() loop reads from FILE and puts the result
> into $_. You then read again inside the loop and print that line.
^^^^^^^^^
No, he prints _all_ the rest of the lines, as print() puts
list context on the input operator.
> The effect is to print only every second line of the file,
The effect is to print every line of the file except the first line.
The while loop executes exactly one time, as it will be at EOF after the print().
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 15 Jun 2003 02:27:47 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: book
Message-Id: <DQQGa.10106$gs5.5326536@news4.srv.hcvlny.cv.net>
"j" <john62@electronmail.com> wrote in message
news:3EEA9EBA.3080309@electronmail.com...
> could someone recommend a good perl book to me?
>
You will find a Perl book "good" only if you have the required
background, if it adds substantially to your knowledge, and if it
addresses issues that you consider important. It is unlikely that you
will find one book that meets all of these goals, and even if you do,
you will outgrow it.
I recommend that all beginners start with "Learning Perl" and
"Programming Perl". You probably can skip "Learning" if you have a
solid knowledge of another computer language especially "C". These
books do not directly address any application area, but they provide the
background you will need to read the application specific books.
You cannot learn Perl by reading alone, you must write and rewrite a lot
of your own programs. I found "Perl in a Nutshell" to be a useful
reference until I learned to use perldoc (and Unix grep). The
documentation accessible via perldoc is the final authority. It is
often difficult to read because it is intended as a terse reference
rather than a tutorial. Check it frequently. Seek help from other
books or the newsgroups when you cannot understand it.
I certainly hope that I have not discouraged you from learning Perl. It
is a rather large language, but it allows us to develop clear and
concise programs in nearly every application area.
Bill
------------------------------
Date: Sat, 14 Jun 2003 21:14:58 -0400
From: Joey Hess <joey@dragon.kitenet.net>
Subject: Re: die and exception over-stringification
Message-Id: <slrnbeni4h.a1q.joey@dragon.kitenet.net>
In article <3eeb380b.236006476@news.erols.com>, Jay Tilton wrote:
> Dunno what version you're running, but I don't see that second
> "expensive operation here (for exception #2)"
> line on Perl 5.8. No matter.
I have perl 5.8.0 here.
> For debugging, you might use Carp::cluck() to trace the call stack and
> determine with more certainty where the extra stringifying operation
> is happening.
I did try to get some backtraces, but they were not useful. It just said
it was happening on the line that calls die.
> If die() really is double-stringifying its argument, you could head it
> off and stringify the argument before die() ever gets a chance to
> touch it.
>
> die( ''. My::Exception->new );
>
> Lastly, and I don't know how well this may apply to your program,
> consider rolling the expensive operation off into a subroutine that
> memoizes itself, so it's only expensive the first time it happens.
> Maybe even make the stringing method memoize the object's stringy form
> within the object itself.
The problem is that I'd rather only run my expensive operation (it
generates a _very_ expensive sort of call trace that's specific to my
environment) if the exception is actually displayed. If something
catches the exception, all that work would just be thrown away.
So my current hack looks like this:
use overload '""' => sub {
my $this=shift;
$SIG{__DIE__} = sub {
my $error=shift;
return if $error !~ /\ncallstack:\n/s;
return if ! defined $^S || $^S; # inside eval
die $error."\t".join("\n\t", $this->{object}->calltrace)."\n"
};
$this->{message}."\ncallstack:\n";
}
Gruss huh.
--
see shy jo
------------------------------
Date: Sun, 15 Jun 2003 03:48:43 GMT
From: Steve Grazzini <grazz@pobox.com>
Subject: Re: die and exception over-stringification
Message-Id: <v0SGa.2280$Uj1.226@nwrdny02.gnilink.net>
Joey Hess <joey@kitenet.net> wrote:
> I have an exception class that overloads stringify [...] it
> seems that die always stringifies it, and sometimes it will
> even get stringified twice.
It's (another symptom of) a known bug:
http://rt.perl.org/rt2/Ticket/Display.html?id=17763
> Grr, this is annoying.
Patch to fix it is there as well. :-)
--
Steve
------------------------------
Date: Sat, 14 Jun 2003 22:26:44 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Distributed CGI script in taint mode
Message-Id: <bcg0gm$iuvl8$1@ID-184292.news.dfncis.de>
I have just made the necessary tweaking of a CGI script to enable the
-T flag. To be able to run other programs, without knowing their
location, I'm currently doing the following:
$ENV{PATH} = securepath();
sub securepath {
my $sep = $^O eq 'MSWin32' ? ';' : ':';
my @paths = ();
for (split $sep, $ENV{PATH}) {
if (m!^((?:\w:)?[\w-./ \\~]*)$!) {
push @paths, $1;
} else {
die 'Insecure $ENV{PATH}';
}
}
return join $sep, @paths;
}
The above function doesn't change the contents of $ENV{PATH}, it just
untaints it. Even if I realize that I circumvent this aspect of the
taint check, I haven't found a better solution without having the
users state the directories of the programs in question in a config
file. (There are hundreds of users out there on various servers.)
Is there any other available option without causing that extra
inconvenience at installation? Any thoughts would be appreciated.
/ Gunnar
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sat, 14 Jun 2003 20:14:11 -0500
From: "Freegift Roger" <zqmkxlwu@xpljwkvs.com>
Subject: Free gifts give away, limited quantity
Message-Id: <bcgorn$gch$966@news.chatlink.com>
This is a multi-part message in MIME format
--=_NextPart_2rfkindysadvnqw3nerasdf
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Free laser pointer and free harmonica give away,
limited time offer, limited quantity, while supply last
http://www.zeroboss.com for details
*******************************************************
* http://www.zeroboss.com *
*******************************************************
-- Homebase business opportunities, FREE to join
-- Quality Jewelry, watches, cookware, toys on Sale
at low wholesale price, several wharehouses
*******************************************************
--=_NextPart_2rfkindysadvnqw3nerasdf
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
Free laser pointer and free harmonica give away,
limited time offer, limited quantity, while supply last
see detail at http://www.zeroboss.com
--=_NextPart_2rfkindysadvnqw3nerasdf--
------------------------------
Date: 14 Jun 2003 14:16:09 -0700
From: rdacker@pacbell.net (rdack)
Subject: Re: get data on socket problem
Message-Id: <644f6688.0306141316.50c864c5@posting.google.com>
Chris Lowth <dont@want.spam> wrote in message news:<P3IGa.3345$LP.1261@newsfep4-winn.server.ntli.net>...
> Can we see the sender code too?
i found my problem. i read the previous ten bytes with 'read' command
(i knew it was ascii). shouldn't mix 'read' and 'sysread'. worked when
i changed the 'read' to 'sysread'. i knew that. lesson relearned.
thanks.
------------------------------
Date: 14 Jun 2003 20:09:01 -0700
From: mlaks2000@yahoo.com (Mitchell Laks)
Subject: howto stop win32 perl script running under "scheduled tasks" from opening black window?
Message-Id: <ab3b13db.0306141909.2263a060@posting.google.com>
Hi,
I usually program on Linux machines. However, I needed to automate a
task on a set of Win2K machines for end users.
So I wrote a perl script using the ActiveState perl distribution, DBI,
DBD::ODBC, to interact with an Access database and change some values.
I wanted this task to start up in the background every few minutes,
and check the database.
I thought to use the Microsoft "Scheduled Task" feature to the run it
as a scheduled task every 2 minutes. It works fine, except for one
thing.
Whenever the program starts it opens up a "black window" (shall I say
XTerminal (?dos window)) which then goes away. This is annoying to end
users who stare at the screen all day long.
This happens even though my code is not generating any output to
STDOUT or STDERR to demand a "black window". to write to.
I wonder if this is related to a funny thing I noticed. If you run a
program in a dos window, it skips a line on the screen before giving
you a new prompt/ even if the program has no output. On Linux this
does not occur. If you run a program with no output, you get the
prompt on the next line. I wonder if this blank line is a "default
output" in "microsoft land" that is causing the "black window" to be
generated.
What can I do to run a daemon like this without generating silly black
windows?
Thanks,
Mitchell
------------------------------
Date: Sun, 15 Jun 2003 03:22:29 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: howto stop win32 perl script running under "scheduled tasks" from opening black window?
Message-Id: <3EEBE674.9000208@rochester.rr.com>
Mitchell Laks wrote:
...
> Whenever the program starts it opens up a "black window" (shall I say
> XTerminal (?dos window)) which then goes away. This is annoying to end
> users who stare at the screen all day long.
Try using:
wperl -w scriptname.pl
rather than
perl -w scriptname.pl
to run your script (assuming you're running ActiveState Perl). That
should start and run Perl without the "black window".
...
> I wonder if this is related to a funny thing I noticed. If you run a
> program in a dos window, it skips a line on the screen before giving
> you a new prompt/ even if the program has no output. On Linux this
> does not occur. If you run a program with no output, you get the
> prompt on the next line. I wonder if this blank line is a "default
> output" in "microsoft land" that is causing the "black window" to be
> generated.
Yeah, the Windoze command interpreter has a few bugs, varying with the
version. It does the same thing with other programs, too, so it's not a
Perl issue. Sounds like you haven't found the really annoying ones yet.
...
> Mitchell
--
Bob Walton
------------------------------
Date: Sat, 14 Jun 2003 18:16:35 GMT
From: Sean O'Dwyer <notspam@spamfree.dud>
Subject: Re: list commands query
Message-Id: <notspam-F617BD.14163614062003@syrcnyrdrs-03-ge0.nyroc.rr.com>
In article <6_FGa.13499$Bw2.7836@nwrddc03.gnilink.net>,
"Jürgen Exner" <jurgenex@hotmail.com> wrote:
> For questions like those you should _always_ check the manual. It is the
> ultimate source of information (beside the source code of perl, of course).
Ultimate shmultimate. The problem with the manual and much other online
documentation is that it's often pure geekery and can be, for
non-hardcore programmers, quite difficult to comprehend. For me, the
language "pushes the values of LIST onto the end of ARRAY" raises more
questions than it answers. From my early training in BASIC, I'm more
comfortable calling them arrays, as are the other folks who replied, but
the author quoted likes to call them lists for some reason and has
further confused me with apparently contradictory statements. So I was
looking for some human sense and direction which, thankfully, I got from
the other replies.
I know there are lazy people in newsgroups who simply want answers to
complex questions without doing any work themselves, but I'm not one of
them; before I post, I always make some effort on the problem at hand.
It's twice as tiresome to read supercillious postings from the
self-appointed netiquette police as it is to simply skip over lazy
postings. So MY unsolicitied advice to YOU is to stop and think before
wasting your time rattling off snooty smackdowns.
------------------------------
Date: 14 Jun 2003 18:48:23 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: list commands query
Message-Id: <slrnbemrfn.bfc.sholden@flexal.cs.usyd.edu.au>
On Sat, 14 Jun 2003 18:16:35 GMT, Sean O'Dwyer <notspam@spamfree.dud> wrote:
> In article <6_FGa.13499$Bw2.7836@nwrddc03.gnilink.net>,
> "Jürgen Exner" <jurgenex@hotmail.com> wrote:
>
>> For questions like those you should _always_ check the manual. It is the
>> ultimate source of information (beside the source code of perl, of course).
>
> Ultimate shmultimate. The problem with the manual and much other online
> documentation is that it's often pure geekery and can be, for
> non-hardcore programmers, quite difficult to comprehend. For me, the
> language "pushes the values of LIST onto the end of ARRAY" raises more
> questions than it answers. From my early training in BASIC, I'm more
> comfortable calling them arrays, as are the other folks who replied, but
> the author quoted likes to call them lists for some reason and has
> further confused me with apparently contradictory statements. So I was
> looking for some human sense and direction which, thankfully, I got from
> the other replies.
I think you are using a different definition of ultimate than the rest of
us. Ultimate can mean "greatest possible", but in the context it was
used above it means "fundamental". No one claims the perl documentation
is the greatest possible user friendly documentation on earth (though I
think most would agree it is better than most of its peers). It is the
fundamental documentation though.
What it says goes. If some other documentation disagrees with it, then
that documentation is incorrect. Well in theory. Of course, in practice
errors happens (and the perl code gets ahead of the docs).
LIST and ARRAY are both defined, as the first and second of push. And the
start of the perlfunc docs explains what LIST means when used as an argument.
And perldata descibes what arrays are and what a list is in perl.
The documentation can't describe everything everywhere. It has to define
some terms in one place and then use those terms elsewhere. List and array
are examples of such terms.
>
> I know there are lazy people in newsgroups who simply want answers to
> complex questions without doing any work themselves, but I'm not one of
> them; before I post, I always make some effort on the problem at hand.
>
> It's twice as tiresome to read supercillious postings from the
> self-appointed netiquette police as it is to simply skip over lazy
> postings. So MY unsolicitied advice to YOU is to stop and think before
> wasting your time rattling off snooty smackdowns.
The post you are replying to gave good advice that would help with future
queries. The poster can't know if the original poster had checked the perl
docs. It's up to the poster to mention that by saying something like:
"I've checked the perlfunc documentation on push, but I can't understand
what LIST and ARRAY mean". If they don't and their answer is in the docs,
they are going to get a pointer to those docs - of course then they can
say what I said above and they'll get a better answer (that's also one way
the docs get improved).
--
Sam Holden
------------------------------
Date: Sat, 14 Jun 2003 13:49:08 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: list commands query
Message-Id: <slrnbemrh4.8dh.tadmc@magna.augustmail.com>
Sean O'Dwyer <notspam@spamfree.dud> wrote:
> In article <6_FGa.13499$Bw2.7836@nwrddc03.gnilink.net>,
> "Jürgen Exner" <jurgenex@hotmail.com> wrote:
>
>> For questions like those you should _always_ check the manual. It is the
>> ultimate source of information (beside the source code of perl, of course).
>
> Ultimate shmultimate.
No plonks for a week, then 3 in one day. Wa's up with that?
> The problem with the manual and much other online
> documentation is that it's often pure geekery and can be, for
> non-hardcore programmers, quite difficult to comprehend.
Then you post a question about the part of the docs that you
don't understand, and we'll help you understand it. (note how this
differs from never looking it up in the first place.)
> For me, the
> language "pushes the values of LIST onto the end of ARRAY" raises more
> questions than it answers.
The concepts of "list" and "array" are important to understanding Perl.
If you don't want to understand Perl, then why bother asking?
If you do want to understand Perl, then you probe further (or ask
here) to find out what they are, and why the distinction matters.
> From my early training in BASIC, I'm more
> comfortable calling them arrays, as are the other folks who replied,
We don't talk BASIC here. We talk Perl here.
> but
> the author quoted likes to call them lists for some reason
Because there is a fundamental and important distinction between them.
Pretending they are the same will most certainly lead to _more_
confusion it the future. Learn the difference and be immune to
that whole class of errors for now and for evermore.
> It's twice as tiresome to read supercillious postings from the
> self-appointed netiquette police as it is to simply skip over lazy
> postings.
It's thrice as tiresome to read supercillious postings from the
unknowledgeable instructing the knowledgeable on how it should be done,
as it is to simply skip over the knowledgeable's postings.
> So MY unsolicitied advice to YOU is to stop and think before
> wasting your time rattling off snooty smackdowns.
*plonk*
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 14 Jun 2003 20:32:02 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: list commands query
Message-Id: <3eeb7135.250642637@news.erols.com>
Sean O'Dwyer <notspam@spamfree.dud> wrote:
: In article <6_FGa.13499$Bw2.7836@nwrddc03.gnilink.net>,
: "Jürgen Exner" <jurgenex@hotmail.com> wrote:
:
: > For questions like those you should _always_ check the manual. It is the
: > ultimate source of information (beside the source code of perl, of course).
:
: Ultimate shmultimate.
Elaborate on your disagreement. Perl's own documentation would
logically be the final word on Perl.
: The problem with the manual and much other online
: documentation is that it's often pure geekery and can be, for
: non-hardcore programmers, quite difficult to comprehend.
Unavoidable. Perl is not a programming tutorial, nor does it pretend
to be one.
: For me, the
: language "pushes the values of LIST onto the end of ARRAY" raises more
: questions than it answers.
What are those questions?
: From my early training in BASIC, I'm more
: comfortable calling them arrays, as are the other folks who replied, but
: the author quoted likes to call them lists for some reason and has
: further confused me with apparently contradictory statements.
The distinction between lists and arrays can be subtle in places, but
it is not trivial. Habitually confusing the two is evidence that the
author does not adequately understand his subject matter.
: I know there are lazy people in newsgroups who simply want answers to
: complex questions without doing any work themselves, but I'm not one of
: them; before I post, I always make some effort on the problem at hand.
Understood.
The newsgroup's history has shown that when an article's author does
not say he has read the manual, it is a mistake to infer that he has.
If you believe you have been insulted by being told to RTFM when you
already have, either learn to include that kind of relevant
information in your articles or grow some skin.
: It's twice as tiresome to read supercillious postings from the
: self-appointed netiquette police as it is to simply skip over lazy
: postings.
Agree. Was it easier to write your rant than it would have been to
exercise your newsreader's killfile? Whose time is really being
wasted here?
: So MY unsolicitied advice to YOU is to stop and think before
: wasting your time rattling off snooty smackdowns.
Jürgen is neither snooty nor abusive. Stick around and read some more
of him. You may rethink that opinion.
------------------------------
Date: 14 Jun 2003 20:52:16 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: list commands query
Message-Id: <Xns939AAB9F66894asu1cornelledu@132.236.56.8>
Sean O'Dwyer <notspam@spamfree.dud> wrote in
news:notspam-F617BD.14163614062003@syrcnyrdrs-03-ge0.nyroc.rr.com:
> In article <6_FGa.13499$Bw2.7836@nwrddc03.gnilink.net>,
> "Jürgen Exner" <jurgenex@hotmail.com> wrote:
>
>> For questions like those you should _always_ check the manual. It is
>> the ultimate source of information (beside the source code of perl,
>> of course).
<snip>
> It's twice as tiresome to read supercillious postings from the
> self-appointed netiquette police as it is to simply skip over lazy
> postings. So MY unsolicitied advice to YOU is to stop and think before
> wasting your time rattling off snooty smackdowns.
This is totally uncalled for. If you don't know how to say thank you, you
can still choose not to respond (or maybe there is a dummies book to
teach how to say thank you). BTW, I am a total newbie when it comes to
Perl, but if you are confused about the difference between arrays and
lists (as I was at one point), you can simply do:
perldoc -q list
which will tell you:
Found in C:\Perl\lib\pod\perlfaq4.pod
What is the difference between a list and an array?
An array has a changeable length. A list does not. An array is
something you can push or pop, while a list is a set of values.
Some people make the distinction that a list is a value while a
array is a variable. Subroutines are passed and return lists,
you put things into list context, you initialize arrays with
lists, and you foreach() across a list. "@" variables are
arrays, anonymous arrays are arrays, arrays in scalar context
behave like the number of elements in them, subroutines access
their arguments through the array @_, and push/pop/shift only
work on arrays.
As a side note, there's no such thing as a list in scalar
context. When you say
$scalar = (2, 5, 7, 9);
you're using the comma operator in scalar context, so it uses
the scalar comma operator. There never was a list there at all!
This causes the last value to be returned: 9.
I don't know how much clearer it can get, but if you still have problems,
I am sure someone here would be able to clarify if you ask nicely.
--
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 5123
***************************************