[26456] in Perl-Users-Digest
Perl-Users Digest, Issue: 8625 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 3 05:17:02 2005
Date: Thu, 3 Nov 2005 02:16:55 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 3 Nov 2005 Volume: 10 Number: 8625
Today's topics:
Re: FAQ 3.24 Can I write useful Perl programs on the co Ben Wa
Re: FAQ 3.24 Can I write useful Perl programs on the co <1usa@llenroc.ude.invalid>
FAQ 8.40 How do I avoid zombies on a Unix system? <comdog@pair.com>
Re: FAQ 9.16: How do I decode a CGI form? Ben Wa
Re: How to use string as two dimensional array <tadmc@augustmail.com>
Re: IIS 5.1 + Perl <flavell@ph.gla.ac.uk>
m//ms (was Re: s///x) <tadmc@augustmail.com>
Re: s///x <rvtol+news@isolution.nl>
Re: s///x <noreply@gunnar.cc>
Re: s///x <tadmc@augustmail.com>
Re: s///x <stan.remove@bremove.lz.hmrprint.com>
Re: s///x <tadmc@augustmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 02 Nov 2005 21:35:18 -0800
From: Ben Wa
Subject: Re: FAQ 3.24 Can I write useful Perl programs on the command line?
Message-Id: <f28jm1ltd46glkafss05suhkdbnbmp924n@4ax.com>
On Wed, 2 Nov 2005 11:03:01 +0000 (UTC), PerlFAQ Server
<comdog@pair.com> wrote:
>This message is one of several periodic postings to comp.lang.perl.misc
>intended to make it easier for perl programmers to find answers to
>common questions. The core of this message represents an excerpt
>from the documentation provided with Perl.
>
>--------------------------------------------------------------------
>
>3.24: Can I write useful Perl programs on the command line?
I think this pretty much sums up the groups 1-liner mentality....
>
> Yes. Read perlrun for more information. Some examples follow. (These
> assume standard Unix shell quoting rules.)
>
> # sum first and last fields
> perl -lane 'print $F[0] + $F[-1]' *
>
> # identify text files
> perl -le 'for(@ARGV) {print if -f && -T _}' *
>
> # remove (most) comments from C program
> perl -0777 -pe 's{/\*.*?\*/}{}gs' foo.c
>
> # make file a month younger than today, defeating reaper daemons
> perl -e '$X=24*60*60; utime(time(),time() + 30 * $X,@ARGV)' *
>
> # find first unused uid
> perl -le '$i++ while getpwuid($i); print $i'
>
> # display reasonable manpath
> echo $PATH | perl -nl -072 -e '
> s![^/+]*$!man!&&-d&&!$s{$_}++&&push@m,$_;END{print"@m"}'
>
> OK, the last one was actually an Obfuscated Perl Contest entry. :-)
>
>
>
'Usefull' depends upon if your getting paid to do it by the line,
then not so useful, eh?
------------------------------
Date: Thu, 03 Nov 2005 05:44:49 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: FAQ 3.24 Can I write useful Perl programs on the command line?
Message-Id: <Xns970379ADFAAAasu1cornelledu@127.0.0.1>
Ben Wa wrote in news:f28jm1ltd46glkafss05suhkdbnbmp924n@4ax.com:
> On Wed, 2 Nov 2005 11:03:01 +0000 (UTC), PerlFAQ Server
> <comdog@pair.com> wrote:
>
...
>>
>>3.24: Can I write useful Perl programs on the command line?
>
> I think this pretty much sums up the groups 1-liner mentality....
Care to explain what that mentality is?
>>
>> Yes. Read perlrun for more information. Some examples follow.
...
> 'Usefull' depends upon if your getting paid to do it by the line,
> then not so useful, eh?
The examples given are 'useful' because they are means to achieve
specific ends.
The following one-liner should help you achieve your aim:
D:\> perl -e "print qq{my var$_;\n} for (1 .. 1_000_000)" > payme.pl
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Thu, 3 Nov 2005 05:03:01 +0000 (UTC)
From: PerlFAQ Server <comdog@pair.com>
Subject: FAQ 8.40 How do I avoid zombies on a Unix system?
Message-Id: <dkc5m5$gva$1@reader2.panix.com>
This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.
--------------------------------------------------------------------
8.40: How do I avoid zombies on a Unix system?
Use the reaper code from "Signals" in perlipc to call wait() when a
SIGCHLD is received, or else use the double-fork technique described in
"How do I start a process in the background?" in perlfaq8.
--------------------------------------------------------------------
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-2002 Tom Christiansen and Nathan
Torkington, and other contributors as noted. All rights
reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
------------------------------
Date: Wed, 02 Nov 2005 23:17:42 -0800
From: Ben Wa
Subject: Re: FAQ 9.16: How do I decode a CGI form?
Message-Id: <v3ejm1h9s1b5cs7g0o163u37m5l12lihva@4ax.com>
On Thu, 11 Nov 2004 11:54:40 +0100, Gunnar Hjalmarsson
<noreply@gunnar.cc> wrote:
>PerlFAQ Server wrote:
>> You use a standard module, probably CGI.pm.
>
>How about:
>
>You use a module, probably the standard module CGI.pm. There are other,
>more specialised CPAN modules available, such as CGI::Lite, CGI::Fast
>and CGI::Minimal.
>
>It's generally not advisable to use hand-written code,
I'm glad u qualified that statement since most here use hand
written code, the regulars the most. Unfortunately its used as
a weapon against the observedly new posters. Uhh, you should
watch that.
------------------------------
Date: Wed, 2 Nov 2005 19:55:01 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: How to use string as two dimensional array
Message-Id: <slrndmirfl.ko2.tadmc@magna.augustmail.com>
Tad McClellan <tadmc@augustmail.com> wrote:
> while ( my $row = substr $str, 0, 3, '' ) {
Doh!
while ( my $row = substr $str, 0, $dim, '' ) {
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 2 Nov 2005 23:24:56 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: IIS 5.1 + Perl
Message-Id: <Pine.LNX.4.62.0511022320410.30649@ppepc56.ph.gla.ac.uk>
On Wed, 2 Nov 2005, John Bokma wrote:
> "Alan J. Flavell" <flavell@ph.gla.ac.uk> wrote:
>
> > Note the "for example", as if there are other possibilities (e.g
> > downgrading a text/plain document to an amorphous bag of bytes ?).
>
> No, since the sentence before says: *never* upgrade.
Right, which can mean "leave the same, or sometimes downgrade". The
latter is what seems to be getting reported here, I thought, and
that's the point that I was trying to make, despite their claim that
it's "not ambiguous".
> There are more upgrade examples (excercise: think up a few :-) ).
Of course; but it's what they *don't* say that is often the important
part of the message.
best regards
------------------------------
Date: Wed, 2 Nov 2005 20:47:53 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: m//ms (was Re: s///x)
Message-Id: <slrndmiuip.kre.tadmc@magna.augustmail.com>
Abigail <abigail@abigail.nl> wrote:
> Damian makes a good argument in PBP to always use /s and /m.
I'd better go read it.
> I don't think it's worth raising your finger if someone uses /s or /m
> on a regex where it doesn't matter.
To me, modifiers mean "something out of the ordinary here, pay attention!".
I feel tricked when I try to figure out why the programmer wanted dot
to match newline, only to find that there isn't even a dot in the pattern.
> It's like complaining someone uses
> 'use warnings' on a piece of code where it didn't matter.
'use warnings' always matters.[1] (heh)
[1] Message-ID: <slrn99mn0h.n9t.bernard.el-hagin@gdndev32.lido-tech>
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 3 Nov 2005 00:26:59 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: s///x
Message-Id: <dkbmob.1bs.1@news.isolution.nl>
Anno Siegel schreef:
> The changes by /x only affect the regex proper. The replacement part
> is still an ordinary double-quotish string.
OK. I am still trying to think up why it was chosen to not affect the
replacement part. I have no doubt that there is a simple explanation why
it is not feasible, but I just can't think it up (tired of working some
very long days, but very satisfied with the results and very happy with
Perl).
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Thu, 03 Nov 2005 02:46:10 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: s///x
Message-Id: <3st8b8Fo3mnlU1@individual.net>
Abigail wrote:
> Gunnar Hjalmarsson (noreply@gunnar.cc) wrote on MMMMCDXLVI September
> MCMXCIII in <URL:news:3ss54cFpe3koU1@individual.net>:
> ** Dr.Ruud wrote:
> ** > I don't consider the /s modifier redundant. It was not needed in my
> ** > example, so maybe you meant "redundant here"?
> **
> ** Okay, redundant (or extraneous...) here. I mentioned it because people
> ** misunderstand the meaning of it all the time, and I believe one reason
> ** for that is that "perldoc perlre" - unlike e.g. "perldoc perlop" - is
> ** the only place in the docs (to my knowledge) where its meaning is
> ** properly explained.
>
> Damian makes a good argument in PBP to always use /s and /m.
What's PBP?
> I don't think it's worth raising your finger if someone uses /s or /m
> on a regex where it doesn't matter. It's like complaining someone uses
> 'use warnings' on a piece of code where it didn't matter.
A better parallel IMO is that it's like complaining when someone calls a
function using '&' without knowing the implications of doing so. It
'works' most of the time, but not always...
(Not saying that Dr. Ruud doesn't know the implications of using the /s
modifier. It's now obvious that he does.)
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Wed, 2 Nov 2005 20:02:05 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: s///x
Message-Id: <slrndmirst.ko2.tadmc@magna.augustmail.com>
Dr.Ruud <rvtol+news@isolution.nl> wrote:
> Anno Siegel schreef:
>
>> The changes by /x only affect the regex proper. The replacement part
>> is still an ordinary double-quotish string.
>
> OK. I am still trying to think up why it was chosen to not affect the
> replacement part.
Because spaces are _supposed_ to matter when they are in a string.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 2 Nov 2005 19:27:07 -0800
From: "Stan R." <stan.remove@bremove.lz.hmrprint.com>
Subject: Re: s///x
Message-Id: <1130988602_1915@spool6-east.superfeed.net>
Tad McClellan wrote:
> Dr.Ruud <rvtol+news@isolution.nl> wrote:
>> Anno Siegel schreef:
>>
>>> The changes by /x only affect the regex proper. The replacement
>>> part is still an ordinary double-quotish string.
>>
>> OK. I am still trying to think up why it was chosen to not affect the
>> replacement part.
>
>
> Because spaces are _supposed_ to matter when they are in a string.
Tad, what I think he might be getting at is if there soem a possibility
to have a modifier on a literal strings to allow cmments. I cna see how
doign that might not make a lot of sense in many ways (its a string for
cryin' out loud!), but I just thought I'd point out it seems his
thinking is hinting in that general direction perhaps.
--
Stan
------------------------------
Date: Wed, 2 Nov 2005 20:51:19 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: s///x
Message-Id: <slrndmiup7.kre.tadmc@magna.augustmail.com>
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> What's PBP?
Peanut Butter Perl? :-)
Or "Perl Best Practices":
http://www.oreilly.com/catalog/perlbp/
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 8625
***************************************