[29626] in Perl-Users-Digest
Perl-Users Digest, Issue: 870 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 20 21:09:44 2007
Date: Thu, 20 Sep 2007 18:09:12 -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 Thu, 20 Sep 2007 Volume: 11 Number: 870
Today's topics:
Re: are you using Perl in your job? <veatchla@yahoo.com>
Concatenation: $i.$j different from "$i$j" <Occidental@comcast.net>
Re: Concatenation: $i.$j different from "$i$j" xhoster@gmail.com
Re: FAQ 4.8 How do I perform an operation on a series o <bill@ts1000.us>
Re: how to remove duplicate header line in CGI dmedhora@gmail.com
Re: List Variable becomes undefined inexplicably <rvtol+news@isolution.nl>
Re: List Variable becomes undefined inexplicably <cwilbur@chromatico.net>
Re: List Variable becomes undefined inexplicably <abigail@abigail.be>
Re: List Variable becomes undefined inexplicably mattbreedlove@yahoo.com
Re: List Variable becomes undefined inexplicably <kkeller-usenet@wombat.san-francisco.ca.us>
Re: List Variable becomes undefined inexplicably <uri@stemsystems.com>
Re: List Variable becomes undefined inexplicably <benkasminbullock@gmail.com>
Re: List Variable becomes undefined inexplicably mattbreedlove@yahoo.com
Re: perl and unix command <lerameur@yahoo.com>
Re: perl and unix command <allergic-to-spam@no-spam-allowed.org>
Re: perl and unix command <chris-usenet@roaima.co.uk>
Perl modules for handling Majordomo lists <bill@ts1000.us>
Re: PERL PACKAGE IN MODULE <eser@libero.it>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 20 Sep 2007 14:25:45 -0500
From: l v <veatchla@yahoo.com>
Subject: Re: are you using Perl in your job?
Message-Id: <13f5i816m0dkf5f@news.supernews.com>
Abigail wrote:
> _
[snip]
>
>
> Pffft. They still need COBOL programmers.... ;-)
... and mainframes.
But then again, my mainframe *does* have Perl installed on it :)
--
Len
------------------------------
Date: Thu, 20 Sep 2007 15:22:48 -0700
From: Occidental <Occidental@comcast.net>
Subject: Concatenation: $i.$j different from "$i$j"
Message-Id: <1190326968.806350.110790@k79g2000hse.googlegroups.com>
{
my $i = "TT";
my $j = "AT";
if ("$i$j" =~ /X/)
{
print "$i$j matched\n";
}
else
{
print "$i$j not matched\n";
}
}
{
my $i = "TT";
my $j = "AT";
if ($i.$j =~ /X/)
{
print $i.$j . " matched\n";
}
else
{
print $i.$j . " not matched\n";
}
}
gives
TTAT not matched
TTAT matched
Can anyone explain?
------------------------------
Date: 20 Sep 2007 22:37:50 GMT
From: xhoster@gmail.com
Subject: Re: Concatenation: $i.$j different from "$i$j"
Message-Id: <20070920183753.527$CP@newsreader.com>
Occidental <Occidental@comcast.net> wrote:
>
> if ($i.$j =~ /X/)
> Can anyone explain?
Precedence can. =~ is two lines above . in the perlop list of
precedences.
$ perl -MO=Deparse,-p -e ' "x"."y" =~ /f/'
('x' . ('y' =~ /f/));
-e syntax OK
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Thu, 20 Sep 2007 18:08:00 -0700
From: Bill H <bill@ts1000.us>
Subject: Re: FAQ 4.8 How do I perform an operation on a series of integers?
Message-Id: <1190336880.996788.294870@y42g2000hsy.googlegroups.com>
On Sep 20, 9:03 pm, PerlFAQ Server <br...@stonehenge.com> wrote:
> This is an excerpt from the latest version perlfaq4.pod, which
> comes with the standard Perl distribution. These postings aim to
> reduce the number of repeated questions as well as allow the community
> to review and update the answers. The latest version of the complete
> perlfaq is athttp://faq.perl.org.
>
> --------------------------------------------------------------------
>
> 4.8: How do I perform an operation on a series of integers?
>
> To call a function on each element in an array, and collect the results,
> use:
>
> @results = map { my_func($_) } @array;
>
> For example:
>
> @triple = map { 3 * $_ } @single;
>
> To call a function on each element of an array, but ignore the results:
>
> foreach $iterator (@array) {
> some_func($iterator);
> }
>
> To call a function on each integer in a (small) range, you can use:
>
> @results = map { some_func($_) } (5 .. 25);
>
> but you should be aware that the ".." operator creates an array of all
> integers in the range. This can take a lot of memory for large ranges.
> Instead use:
>
> @results = ();
> for ($i=5; $i < 500_005; $i++) {
> push(@results, some_func($i));
> }
I have not seen this before. What is the purpose of the "_" in 500_005
or is it just used to replace 500,005?
Bill H
------------------------------
Date: Thu, 20 Sep 2007 17:13:47 -0700
From: dmedhora@gmail.com
Subject: Re: how to remove duplicate header line in CGI
Message-Id: <1190333627.396742.139240@w3g2000hsg.googlegroups.com>
On Sep 19, 6:50 pm, "Mumia W." <paduille.4061.mumia.w
+nos...@earthlink.net> wrote:
> On 09/19/2007 08:46 AM, dmedh...@gmail.com wrote:
>
>
>
> > Hi,
> > Well when I run the script on the command line I get two headers i.e
> > "Content Type" lines
> > printed out, is that good or bad ? [...]
>
> As Mr. Morrow said, that's bad.
>
> When I run the following script on the command line, I get only one
> Content-Type header:
>
> ----------------------script------------------
> #!/usr/bin/perl
>
> use CGI::FormBuilder;
> use Module::Versions::Report;
>
> my @fields = qw(category task status notes);
>
> my $form = CGI::FormBuilder->new(
> method => 'post',
> fields => \@fields,
> validate => {
> status => 'INT', # validate
> },
> required => 'ALL',
> );
>
> if ($form->submitted)
> {
> print $form->confirm(header => 1);} else {
>
> print $form->render(header => 1);}
>
> ----------------------end---------------------
>
> Here is the output:
>
> Content-Type: text/html; charset=ISO-8859-1
>
> <html><head><title>Form Build</title>
> <script language="JavaScript1.3"><!-- hide from old browsers
> function validate (form) {
> var alertstr = '';
> var invalid = 0;
>
> // standard text, hidden, password, or textarea box
> var category = form.elements['category'].value;
> if ( ((! category && category != 0) || category === "")) {
> alertstr += '- You must enter a valid value for the "Category"
> field\n';
> invalid++;
> }
> // standard text, hidden, password, or textarea box
> var task = form.elements['task'].value;
> if ( ((! task && task != 0) || task === "")) {
> alertstr += '- You must enter a valid value for the "Task"
> field\n';
> invalid++;
> }
> // standard text, hidden, password, or textarea box
> var status = form.elements['status'].value;
> if ( (! status.match(/^-?\s*[0-9]+$/)) ) {
> alertstr += '- You must enter a valid value for the "Status"
> field\n';
> invalid++;
> }
> // standard text, hidden, password, or textarea box
> var notes = form.elements['notes'].value;
> if ( ((! notes && notes != 0) || notes === "")) {
> alertstr += '- You must enter a valid value for the "Notes"
> field\n';
> invalid++;
> }
> if (invalid > 0 || alertstr != '') {
> if (! invalid) invalid = 'The following'; // catch for
> programmer error
> alert(''+invalid+' error(s) were encountered with your
> submission:'+'\n\n'+alertstr+'\n'+'Please correct these fields and try
> again.');
> // reset counters
> alertstr = '';
> invalid = 0;
> return false;
> }
> return true; // all checked ok}
>
> //-->
> </script><noscript><font color="red"><b>Please enable JavaScript or use
> a newer browser</b></font></noscript><p></head><body
> bgcolor="white"><h3>Form Build</h3><p>Fields shown in <b>bold</b> are
> required.
> <!-- Generated by CGI::FormBuilder v2.12 available fromwww.formbuilder.org-->
> <form action="form-build.cgi" method="post" onSubmit="return
> validate(this);"><input name="_submitted" type="hidden" value="1"
> /><input name="_sessionid" type="hidden" value="" /><table>
> <tr valign="middle"><td align="left"><b>Category</b></td><td><input
> name="category" type="text" /></td></tr>
> <tr valign="middle"><td align="left"><b>Task</b></td><td><input
> name="task" type="text" /></td></tr>
> <tr valign="middle"><td align="left"><b>Status</b></td><td><input
> name="status" type="text" /></td></tr>
> <tr valign="middle"><td align="left"><b>Notes</b></td><td><input
> name="notes" type="text" /></td></tr>
> <tr valign="middle"><td colspan="2"><center><input name="_reset"
> type="reset" value="Reset" /><input name="_submit" type="submit"
> value="Submit" /></center></td></tr></table>
> </form></body></html>
>
> Perl v5.8.4 under linux
> Modules in memory:
> attributes;
> Carp v1.02;
> CGI v3.04;
> CGI::FormBuilder v2.12;
> CGI::Util v1.4;
> CGITempFile;
> constant v1.04;
> DynaLoader;
> Exporter v5.58;
> Fh;
> Internals;
> Module::Versions::Report v1.02;
> MultipartBuffer;
> overload v1.01;
> PerlIO;
> PerlIO::Layer;
> Regexp;
> strict v1.03;
> UNIVERSAL;
> utf8;
> vars v1.01;
> warnings v1.03;
> warnings::register v1.00;
> [at Wed Sep 19 12:41:01 2007 (local) / Wed Sep 19 17:41:01 2007 (GMT)]
Guys!, I upgraded to 3.0501 as you suggested and voila
its fine! Damn, did I waste a lotta time on this one,
Thanks for your help. I Wonder why I didn't think an
upgrade would help in the first place...:)
Now, the question is ( and u don't have to answer this :)
Do I go the CGI::FormBuilder route or CGI.pm + Javascript
route ? Any ideas on which one is more "your" choice ?
Thanks again!
------------------------------
Date: Thu, 20 Sep 2007 21:25:03 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: List Variable becomes undefined inexplicably
Message-Id: <fcuoir.1cc.1@news.isolution.nl>
Tad McClellan schreef:
> perldoc -q vars
>
> Whatâ?Ts wrong with always quoting "$vars"?
YM: LANG="" perldoc -q vars
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 20 Sep 2007 15:36:22 -0400
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: List Variable becomes undefined inexplicably
Message-Id: <87ps0dqgcp.fsf@mithril.chromatico.net>
>>>>> "mb" == mattbreedlove <mattbreedlove@yahoo.com> writes:
mb> I believe there is a place for strict and warnings. That
mb> place is not necessarily in a quick test script to illustrate
mb> a completely unrelated problem. Thanks
However, it *is* in a script you are asking human beings to help you
with; if you haven't made adequate use of the automatic tools
available to you, why are you wasting other people's time?
Charlton
--
Charlton Wilbur
cwilbur@chromatico.net
------------------------------
Date: 20 Sep 2007 20:37:54 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: List Variable becomes undefined inexplicably
Message-Id: <slrnff5mff.8no.abigail@alexandra.abigail.be>
_
John W. Krahn (dummy@example.com) wrote on VCXXXIII September MCMXCIII in
<URL:news:QHxIi.76846$bO6.50671@edtnps89>:
;; mattbreedlove@yahoo.com wrote:
;; >
;; > PERL should be able to keep track of the frame of reference and values
;; > for two discreet "$_" in nested iterative loops without blowing away a
;; > parent array
;;
;; This "PERL" you speak of may be able to do that but here we use Perl which h
;; only one $_ variable.
The perl on my box has two:
$ perl -wE '$_ = 1; {my $_ = 2; say $_; say $::_}'
2
1
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
------------------------------
Date: Thu, 20 Sep 2007 15:32:02 -0700
From: mattbreedlove@yahoo.com
Subject: Re: List Variable becomes undefined inexplicably
Message-Id: <1190327522.430118.167050@y27g2000pre.googlegroups.com>
Honestly, I am intrigued by this passion about not referring to PERL
in caps. Correct me if I am wrong, but PERL is an Acronym for
Practical Extraction and Reporting Language.
Generally, acronyms are written in caps. If anything I could see
saying that it should be written P.E.R.L
So what is all this frustration about?
------------------------------
Date: Thu, 20 Sep 2007 15:49:17 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: List Variable becomes undefined inexplicably
Message-Id: <e0abs4x2dr.ln2@goaway.wombat.san-francisco.ca.us>
On 2007-09-20, mattbreedlove@yahoo.com <mattbreedlove@yahoo.com> wrote:
> Honestly, I am intrigued by this passion about not referring to PERL
> in caps. Correct me if I am wrong, but PERL is an Acronym for
> Practical Extraction and Reporting Language.
http://en.wikipedia.org/wiki/Perl#Name
--keith
--
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information
------------------------------
Date: Thu, 20 Sep 2007 22:51:10 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: List Variable becomes undefined inexplicably
Message-Id: <x7tzppx869.fsf@mail.sysarch.com>
>>>>> "m" == mattbreedlove <mattbreedlove@yahoo.com> writes:
m> Honestly, I am intrigued by this passion about not referring to
m> PERL in caps. Correct me if I am wrong, but PERL is an Acronym for
m> Practical Extraction and Reporting Language.
you are wrong. read the perlfaq for the real history of the name.
m> Generally, acronyms are written in caps. If anything I could see
m> saying that it should be written P.E.R.L
wronger.
it is Perl for the language and perl for the program. never PERL which
marks you as someone who doesn't know Perl.
m> So what is all this frustration about?
being technically correct and pedantic is a useful attribute in a
programmer. using the correct name is a point that is worth defending.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Thu, 20 Sep 2007 17:12:22 -0700
From: "benkasminbullock@gmail.com" <benkasminbullock@gmail.com>
Subject: Re: List Variable becomes undefined inexplicably
Message-Id: <1190333542.773664.220490@q3g2000prf.googlegroups.com>
On Sep 21, 2:10 am, Jim Gibson <jgib...@mail.arc.nasa.gov> wrote:
> In article <1190303553.751484.24...@z24g2000prh.googlegroups.com>,
>
> <mattbreedl...@yahoo.com> wrote:
> > The only reason the open command was commented was so that anyone
> > could run the test script to reproduce the problem. I tested the test
> > script with or without the commented "open" command so its not like
> > the array is getting undefined by the absence of input to the while
> > loop. It is certainly not the root cause.
>
> No, the open is not the root cause. The root cause is the input
> operator <CMD> that you did _not_ comment out. In general, it is best
> to post only relevant code, replacing such things as reading external
> files with the equivalent assignment statements, for example, or using
> the special <DATA> file handle so people can cut-and-paste your
> program.
>
>
>
> > I believe there is a place for strict and warnings. That place is not
> > necessarily in a quick test script to illustrate a completely
> > unrelated problem. Thanks
>
> Fewer people will analyze your code if you don't have use strict.
>From the number of responses to the original poster's query, it
actually looks like the opposite: many more people will analyze one's
code if one doesn't have "use strict;".
Just an observation.
------------------------------
Date: Thu, 20 Sep 2007 17:29:41 -0700
From: mattbreedlove@yahoo.com
Subject: Re: List Variable becomes undefined inexplicably
Message-Id: <1190334581.780318.88110@e34g2000pro.googlegroups.com>
> it is Perl for the language and perl for the program. never PERL which
> marks you as someone who doesn't know Perl.
Is that kind of like saying someone must not know how to drive well
unless they know how to fix cars?
------------------------------
Date: Thu, 20 Sep 2007 11:53:15 -0700
From: lerameur <lerameur@yahoo.com>
Subject: Re: perl and unix command
Message-Id: <1190314395.574086.306780@50g2000hsm.googlegroups.com>
>
> > Try "man system" - Perl docs are often installed as man pages also.
>
> That will probably get you the system(3) man page instead of Perl's system
> function (although they basicly do the same thing.)
>
> "man perlfunc" will get you the listing for Perl's system function.
>
> > Also, check to see if your OS has a "perl-docs" or similar port|rpm|deb
> > or other package. Some vendors like to split Perl into multiple packages,
> > with separate developer and docs packages.
>
> Kubuntu does this. I had to manually install a lot of stuff.
>
> John
> --
> Perl isn't a toolbox, but a small machine shop where you
> can special-order certain sorts of tools at low cost and
> in short order. -- Larry Wall
I am running on sunOS 5.9 (solaris)
I do not know unix that much, so I do not know if it is a perl issue
with that specific OS.
"man perlfunc" do not work by the way
k
------------------------------
Date: Thu, 20 Sep 2007 21:07:10 +0200 (CEST)
From: Jim Cochrane <allergic-to-spam@no-spam-allowed.org>
Subject: Re: perl and unix command
Message-Id: <slrnff5h6q.mkv.allergic-to-spam@no-spam-allowed.org>
On 2007-09-20, lerameur <lerameur@yahoo.com> wrote:
> On Sep 20, 9:42 am, Glenn Jackman <gle...@ncf.ca> wrote:
>> At 2007-09-20 09:39AM, "lerameur" wrote:
>>
>>
>>
>> > > > Hello,
>>
>> > > > I am writting a perl scipt in unix and I will invoking some unix
>> > > > commands in my script. If the first command takes a few minutes to
>> > > > process, how do I make sure the second command do not start until the
>> > > > first command is finished ?
>>
>> > > perldoc -f system
>>
>> > ..
>>
>> > />perldoc -f system
>> > ksh: perldoc: not found
>>
>> As you're using google already, you might want to use its search
>> function. I hear its pretty good...
>
>
> google?
> 1,680,000 results, most of them refering to unix command in perl, in
> the one I looked, have not seen any with execution time analysis
> between commands.
> maybe you have googled one
http://www.google.com/search?num=20&hl=en&safe=off&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=RW6&q=perldoc+system&btnG=Search
yields (2nd listing):
http://www.ayni.com/perldoc/perl5.8.0/pod/func/system.html
--
------------------------------
Date: Thu, 20 Sep 2007 21:45:19 +0100
From: Chris Davies <chris-usenet@roaima.co.uk>
Subject: Re: perl and unix command
Message-Id: <vn2bs4xknn.ln2@news.roaima.co.uk>
lerameur <lerameur@yahoo.com> wrote [regarding missing "perldoc"]:
> I am running on sunOS 5.9 (solaris)
> I do not know unix that much, so I do not know if it is a perl issue
> with that specific OS.
It's a Solaris issue. Perl is installed into /usr/perl5/5.6.1 but only
perl itself is symlinked back into /usr/bin.
Two solutions, either of which will work:
(a) Add this statement to your ".profile" either near the top, or
immediately after the last line starting "PATH=" (if there is one):
PATH="/usr/perl5/5.6.1/bin:$PATH" export PATH
To make the change effective immediately, also type it directly at
the command prompt (just this once)
(b) Ask your System Administrator to complete Sun's botched installation
of perl, by adding its commands to /usr/bin, with a command such as
this:
cd /usr/bin && ln -s ../perl5/5.6.1/* .
This command will complain that perl already exists - don't worry
about that. Don't forget the trailing dot!!
Hope this helps,
Chris
------------------------------
Date: Thu, 20 Sep 2007 15:34:56 -0700
From: Bill H <bill@ts1000.us>
Subject: Perl modules for handling Majordomo lists
Message-Id: <1190327696.748078.192390@d55g2000hsg.googlegroups.com>
Anyone know of any perl modules that handle majordomo lists on a linux
server (adding, editing etc)? Any / all pointers appreciated.
Bill H
------------------------------
Date: Thu, 20 Sep 2007 13:05:06 -0700
From: colli <eser@libero.it>
Subject: Re: PERL PACKAGE IN MODULE
Message-Id: <1190318706.237218.161970@k79g2000hse.googlegroups.com>
On 19 Set, 18:24, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth colli <e...@libero.it>:
>
> > Hi
> > I need to load one of mine perl template module whose package (which
> > is evoked at the head of each module) at the head of the code should
> > change to be the same of the name of the module I decided to call.
> > Each time I load it I would like to change the name of my module (but
> > the template still remain the same)
> > It is a default module template but can assume different MYNAME.pm so
> > a different package should be evoked for different module
> > name...Instead of MYNAME I would be able to change into MYNAME1 and to
> > change dinamically the package.
> > Is there a perl function to insert in my module instead of the static
> > expression: package MYNAME; ?
>
> There are various ways you could do this, none of which are for the
> faint of heart :). One simple way would be to put the entire module into
> a string eval: then you can perform any replacements you like on the
> code before evalling it. Another would be to use a source filter. Both
> these approaches would fall foul of the fact that Perl will only load a
> given file once, but that can be got around.
>
> However, before you do this you should take a step back. What are you
> actually trying to achieve here? Chances are you can do it without
> resorting to rewriting your module on the fly, say by creating a
> 'package factory' module that will, on request, create a new package and
> import some functions into it.
>
> Ben
Thank you very much
------------------------------
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 V11 Issue 870
**************************************