[25005] in Perl-Users-Digest
Perl-Users Digest, Issue: 7255 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 15 11:07:13 2004
Date: Fri, 15 Oct 2004 08:05:11 -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 Fri, 15 Oct 2004 Volume: 10 Number: 7255
Today's topics:
Re: Getting Additional Perl Newsgroups <bik.mido@tiscalinet.it>
Re: Getting Additional Perl Newsgroups <tadmc@augustmail.com>
Re: hard references/arrays <nobull@mail.com>
Re: Help needed replacing deprecated syntax (Page)
Re: Help needed replacing deprecated syntax <jurgenex@hotmail.com>
Re: Help needed replacing deprecated syntax <uri@stemsystems.com>
Re: Help needed replacing deprecated syntax <tadmc@augustmail.com>
Re: HTML::Parser and <p> behaviour? (Anno Siegel)
Re: HTML::Parser and <p> behaviour? (Anno Siegel)
Re: HTML::Parser and <p> behaviour? <geoff.cox@removethisplease.freeuk.com>
Re: HTML::Parser and <p> behaviour? <usa1@llenroc.ude.invalid>
Re: HTML::Parser and <p> behaviour? <geoff.cox@removethisplease.freeuk.com>
Re: HTML::Parser and <p> behaviour? <1usa@llenroc.ude.invalid>
Re: HTML::Parser and <p> behaviour? (Anno Siegel)
Re: HTML::Parser and <p> behaviour? <geoff.cox@removethisplease.freeuk.com>
Re: HTML::Parser and <p> behaviour? <geoff.cox@removethisplease.freeuk.com>
Re: is there a better way to mkdir? <bik.mido@tiscalinet.it>
Need help - Perl-5.8.5 installation error <ctd028@email.mot.com>
Re: One liner to produce string of n '?'s separated by (Anno Siegel)
Re: References to an array in a foreach <1usa@llenroc.ude.invalid>
Re: Restricting a program to one running instance <bik.mido@tiscalinet.it>
strange behaviour: array elements unexpectedly undeffed (willem)
Re: strange behaviour: array elements unexpectedly unde (itsme(willem))
Re: strange behaviour: array elements unexpectedly unde <phaylon@dunkelheit.at>
Re: strange behaviour: array elements unexpectedly unde <nobull@mail.com>
Re: strange behaviour: array elements unexpectedly unde <dwall@fastmail.fm>
Re: strange behaviour: array elements unexpectedly unde <uri@stemsystems.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 15 Oct 2004 13:20:15 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Getting Additional Perl Newsgroups
Message-Id: <557vm0t5a6cppnpd428k4dduujas334d2j@4ax.com>
On Fri, 15 Oct 2004 01:03:32 GMT, Jim Keenan
<jkeen_via_google@yahoo.com> wrote:
>Actually, I think the reason is not inexplicable. I always look at the
>web interface at my day job -- where I don't have a newsreader.
Pfui! I installed FreeAgent there[*]! But then I also "installed"
putty to log to my university Linux account and read mail, etc. ;-)
Of course this was possible on account of their total lack of security
measueres/controls, etc.
[*] And set up a tiny bat using xdelta to keep data consistent with my
home's installation.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 15 Oct 2004 07:46:52 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Getting Additional Perl Newsgroups
Message-Id: <slrncmvhls.6su.tadmc@magna.augustmail.com>
Jim Keenan <jkeen_via_google@yahoo.com> wrote:
> Google takes 6-9 hours to post messages on its
> own web page. So I've often replied to postings on this group or on
> c.l.p.modules, only to discover later that 4 other people (usually
> including Tad) had already read the original posting and posted
> responses before me.
Beetcha!
Nah nah, nah nah nah!
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 15 Oct 2004 12:05:49 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: hard references/arrays
Message-Id: <ckoalr$qu6$1@sun3.bham.ac.uk>
Tintin wrote:
> "Brian McCauley" <nobull@mail.com> wrote in message
> news:cklnl4$ied$1@sun3.bham.ac.uk...
>
>> push @insert_record => map { @$_[0..5] } @record{'ADDRESS','ELEMENT'};
>
> needs to be
>
> push @insert_record => map { @{$_}[0..5] } @record{'ADDRESS','ELEMENT'};
Not from perl's perspective it doesn't (for details 'perldoc perlref').
I grant you that some _people_ may find it more readable with the
redundant { }.
------------------------------
Date: 15 Oct 2004 07:09:20 -0700
From: dummymb@hotmail.com (Page)
Subject: Re: Help needed replacing deprecated syntax
Message-Id: <6742094.0410150609.6fa64852@posting.google.com>
Ben Morrow <usenet@morrow.me.uk> wrote in message news:<j6a342-gi6.ln1@osiris.mauzo.dyndns.org>...
> Quoth dummymb@hotmail.com (Page):
> > I received the following message:
> >
> > C:\Program Files\Apache Group\Apache2\cgi-bin\corr>perl -wc corrdetail.pl
> > Using an array as a reference is deprecated at corrdetail.pl line 106 (#1)
> > (D deprecated) You tried to use an array as a reference, as in
> > < @foo-[23] >> or < @$ref-[99] >>. Versions of perl <= 5.6.1 used to
> > allow this syntax, but shouldn't have. It is now deprecated, and will be
> > removed in a future version.
> >
> > corrdetail.pl syntax OK
> >
> > Here is the offending line:
> > my $msg = @_->[0];
> >
> > What is the current proper syntax for such a statement?
>
> That depends on what you meant it to do. If you wanted the first item in
> @_, you meant $_[0] (perlsyn). If you wanted to deref an array ref in $_
> then you meant $_->[0] (perlref). If you wanted something else you will
> have to tell us what that was.
>
> Ben
Ok. It's the first line of a function that may or may not have a
string value parameter passed to it. Basically I'm just setting $msg
to that parameter, then I check to see if it has a value like this:
if ($msg ne "") { ... do stuff... }
Which is the correct syntax (of your two above) for this or is there a
better way to do this?
------------------------------
Date: Fri, 15 Oct 2004 14:39:05 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Help needed replacing deprecated syntax
Message-Id: <diRbd.13$n81.1@trnddc08>
Page wrote:
> Ok. It's the first line of a function that may or may not have a
> string value parameter passed to it. Basically I'm just setting $msg
> to that parameter, >
> Which is the correct syntax (of your two above) for this or is there a
> better way to do this?
my $msg = shift; #removes the item from the parameter list
or
my $msg = @_[0]; #does not remove the item from the parameter list
> then I check to see if it has a value like this:
> if ($msg ne "") { ... do stuff... }
There is a difference between an empty string and an undefined string.
jue
------------------------------
Date: Fri, 15 Oct 2004 14:41:09 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Help needed replacing deprecated syntax
Message-Id: <x7d5zk6o5r.fsf@mail.sysarch.com>
>>>>> "JE" == Jürgen Exner <jurgenex@hotmail.com> writes:
JE> my $msg = shift; #removes the item from the parameter list
JE> or
JE> my $msg = @_[0]; #does not remove the item from the parameter list
still wrong. it should be $_[0].
but what is wrong about the classic my ($msg) = @_ ; ?
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: Fri, 15 Oct 2004 09:51:18 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Help needed replacing deprecated syntax
Message-Id: <slrncmvov6.75u.tadmc@magna.augustmail.com>
Jürgen Exner <jurgenex@hotmail.com> wrote:
> my $msg = @_[0]; #does not remove the item from the parameter list
You should always enable warnings when developing Perl code!
heh.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 15 Oct 2004 11:40:00 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: HTML::Parser and <p> behaviour?
Message-Id: <ckocug$k06$1@mamenchi.zrz.TU-Berlin.DE>
Geoff Cox <geoff.cox@removethisplease.freeuk.com> wrote in comp.lang.perl.misc:
> On 14 Oct 2004 20:02:33 GMT, "A. Sinan Unur"
> <1usa@llenroc.ude.invalid> wrote:
> >Again, no code.
>
> No need for any code this time! I see what you mean below and have got
> that working now!
You don't get it, do you?
We want *you* to show your code so we don't have to spend time
guessing what your problem may be. Did you really think Sinan
was apologizing for not giving *you* code? How self-centered
can you get?
Anno
------------------------------
Date: 15 Oct 2004 11:42:51 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: HTML::Parser and <p> behaviour?
Message-Id: <ckod3r$k06$2@mamenchi.zrz.TU-Berlin.DE>
187 <bigal187@removethis.rx.eastcoasttfc.com> wrote in comp.lang.perl.misc:
> Tad McClellan wrote:
> > Pinocchio (aka: Fred Canis, aka: 187, aka: krakle...)
> > <spambiat@yahoo.com> wrote:
>
> * removes himself from that list *
>
> I had a bad day, I don't normally type that bad, /please/ don't
> associate me with usenet holigans like that *shudders* :-)
Eh... pinoccio? How's your nose?
Anno
------------------------------
Date: Fri, 15 Oct 2004 12:38:59 GMT
From: Geoff Cox <geoff.cox@removethisplease.freeuk.com>
Subject: Re: HTML::Parser and <p> behaviour?
Message-Id: <ovgvm0tmqkf1a393noo1srt16786647bfk@4ax.com>
On 15 Oct 2004 11:40:00 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:
>Geoff Cox <geoff.cox@removethisplease.freeuk.com> wrote in comp.lang.perl.misc:
>> On 14 Oct 2004 20:02:33 GMT, "A. Sinan Unur"
>> <1usa@llenroc.ude.invalid> wrote:
>
>> >Again, no code.
>>
>> No need for any code this time! I see what you mean below and have got
>> that working now!
>
>You don't get it, do you?
>
>We want *you* to show your code so we don't have to spend time
>guessing what your problem may be. Did you really think Sinan
>was apologizing for not giving *you* code? How self-centered
>can you get?
Anno,
I appreciate the point you are making - but do keep calm! The text of
my message was sufficient to enable a comment which corrected my error
- why waste the other person's time with code if this is so?
It might be said that you reacted a little too quickly?! Personal
comments and anger really do not help.
Geoff
>
>Anno
------------------------------
Date: 15 Oct 2004 13:21:18 GMT
From: "A. Sinan Unur" <usa1@llenroc.ude.invalid>
Subject: Re: HTML::Parser and <p> behaviour?
Message-Id: <Xns95835F76C3767asu1cornelledu@132.236.56.8>
Geoff Cox <geoff.cox@removethisplease.freeuk.com> wrote in
news:ovgvm0tmqkf1a393noo1srt16786647bfk@4ax.com:
> On 15 Oct 2004 11:40:00 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
> Siegel) wrote:
>
>>Geoff Cox <geoff.cox@removethisplease.freeuk.com> wrote in
>>comp.lang.perl.misc:
>>> On 14 Oct 2004 20:02:33 GMT, "A. Sinan Unur"
>>> <1usa@llenroc.ude.invalid> wrote:
>>
>>> >Again, no code.
>>>
>>> No need for any code this time! I see what you mean below and have
>>> got that working now!
>>
>>You don't get it, do you?
>>
>>We want *you* to show your code so we don't have to spend time
>>guessing what your problem may be. Did you really think Sinan
>>was apologizing for not giving *you* code? How self-centered
>>can you get?
> I appreciate the point you are making - but do keep calm! The text of
> my message was sufficient to enable a comment which corrected my error
> - why waste the other person's time with code if this is so?
Let's just clarify one point: You would not have been wasting my time had
you provided a working piece of code for me (or anyone else following the
thread). The fact that you did not do so is an insult.
If there is a situation where it is acceptable not to post code when
talking about code, I do not know of it.
My
>>> >Again, no code.
was meant to be reminder to YOU that you ought to provide code.
> It might be said that you reacted a little too quickly?! Personal
> comments and anger really do not help.
In this case, you deserve it.
Sinan.
------------------------------
Date: Fri, 15 Oct 2004 14:16:48 GMT
From: Geoff Cox <geoff.cox@removethisplease.freeuk.com>
Subject: Re: HTML::Parser and <p> behaviour?
Message-Id: <4qmvm0lou8qk1gmdqalk809cbpftclkujt@4ax.com>
On 15 Oct 2004 13:21:18 GMT, "A. Sinan Unur"
<usa1@llenroc.ude.invalid> wrote:
>If there is a situation where it is acceptable not to post code when
>talking about code, I do not know of it.
Sinan,
You were kind enough to help me - so I must accept that I was wrong.
Please accept my apologies.
Geoff
>
>My
>
>>>> >Again, no code.
>
>was meant to be reminder to YOU that you ought to provide code.
>
>> It might be said that you reacted a little too quickly?! Personal
>> comments and anger really do not help.
>
>In this case, you deserve it.
>
>Sinan.
------------------------------
Date: 15 Oct 2004 14:38:17 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: HTML::Parser and <p> behaviour?
Message-Id: <Xns95836C37C934Aasu1cornelledu@132.236.56.8>
Geoff Cox <geoff.cox@removethisplease.freeuk.com> wrote in
news:4qmvm0lou8qk1gmdqalk809cbpftclkujt@4ax.com:
> On 15 Oct 2004 13:21:18 GMT, "A. Sinan Unur"
> <usa1@llenroc.ude.invalid> wrote:
>
>
>>If there is a situation where it is acceptable not to post code when
>>talking about code, I do not know of it.
> You were kind enough to help me - so I must accept that I was wrong.
>
> Please accept my apologies.
Thank you. But next time, please start by posting code. Make sure you have
fixed everything that
use strict;
use warnings;
tell you before posting the code.
Sinan.
------------------------------
Date: 15 Oct 2004 14:51:46 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: HTML::Parser and <p> behaviour?
Message-Id: <ckoo62$rge$1@mamenchi.zrz.TU-Berlin.DE>
Geoff Cox <geoff.cox@removethisplease.freeuk.com> wrote in comp.lang.perl.misc:
> On 15 Oct 2004 11:40:00 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
> Siegel) wrote:
>
> >Geoff Cox <geoff.cox@removethisplease.freeuk.com> wrote in
> comp.lang.perl.misc:
> >> On 14 Oct 2004 20:02:33 GMT, "A. Sinan Unur"
> >> <1usa@llenroc.ude.invalid> wrote:
> >
> >> >Again, no code.
> >>
> >> No need for any code this time! I see what you mean below and have got
> >> that working now!
> >
> >You don't get it, do you?
> >
> >We want *you* to show your code so we don't have to spend time
> >guessing what your problem may be. Did you really think Sinan
> >was apologizing for not giving *you* code? How self-centered
> >can you get?
>
> Anno,
>
> I appreciate the point you are making - but do keep calm! The text of
> my message was sufficient to enable a comment which corrected my error
> - why waste the other person's time with code if this is so?
Ah. You got a good reply on a bad question, because someone else
compensated for your lack of effort. And that proves there was
nothing wrong with the question.
"Waste other peoples time with code", indeed. Yes, it takes effort
to prepare code that demonstrates your problem. A mere verbal
description is easier. The person who answers your question will
(almost always) need such code even before beginning to think
about a solution in earnest. So it's either you write that code,
or we have to do it. What, do you suppose, is the preferred
arrangement?
Exploiting a newsgroup by minimizing your own effort so that you
still get useful replies is not a good long-term strategy.
Anno
> It might be said that you reacted a little too quickly?! Personal
No. You have been around for a while.
Anno
------------------------------
Date: Fri, 15 Oct 2004 14:54:38 GMT
From: Geoff Cox <geoff.cox@removethisplease.freeuk.com>
Subject: Re: HTML::Parser and <p> behaviour?
Message-Id: <2lovm0t891m4518lgiggv6rc4uqust31d9@4ax.com>
On 15 Oct 2004 13:21:18 GMT, "A. Sinan Unur"
<usa1@llenroc.ude.invalid> wrote:
>Let's just clarify one point: You would not have been wasting my time had
>you provided a working piece of code for me (or anyone else following the
>thread). The fact that you did not do so is an insult.
Sinan,
on reflection ...
I have offered you my apology which I stand by and will certainly
provide code when asking a code question in any future postings, but
>The fact that you did not do so is an insult.
I do think you are wrong to use the term insult. The first definition
I came across gives
insult - a deliberately offensive act.
Let me asure you that I was not doing this. Apparently I made a
mistake, certainly you thought so, but I thought my problem was
sufficiently elementary that the code was not needed.
It was not my intention to insult you. Perhaps you might withdraw that
comment?
Cheers
Geoff
------------------------------
Date: Fri, 15 Oct 2004 15:03:46 GMT
From: Geoff Cox <geoff.cox@removethisplease.freeuk.com>
Subject: Re: HTML::Parser and <p> behaviour?
Message-Id: <sfpvm0tnecrcj6jpcatch5t70f8sadjqgo@4ax.com>
On 15 Oct 2004 14:38:17 GMT, "A. Sinan Unur"
<1usa@llenroc.ude.invalid> wrote:
>Geoff Cox <geoff.cox@removethisplease.freeuk.com> wrote in
>news:4qmvm0lou8qk1gmdqalk809cbpftclkujt@4ax.com:
>
>> On 15 Oct 2004 13:21:18 GMT, "A. Sinan Unur"
>> <usa1@llenroc.ude.invalid> wrote:
>>
>>
>>>If there is a situation where it is acceptable not to post code when
>>>talking about code, I do not know of it.
>
>> You were kind enough to help me - so I must accept that I was wrong.
>>
>> Please accept my apologies.
>
>Thank you. But next time, please start by posting code. Make sure you have
>fixed everything that
Sinan,
My "on reflection" posting passed your comment re "insult". Thank you
for this message - please do also accept that I had no intention
whatever of insulting you.
Let's just say that I will not forget this exhange and will be more
careful in future!
Cheers
Geoff
------------------------------
Date: Fri, 15 Oct 2004 13:20:17 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: is there a better way to mkdir?
Message-Id: <ed8vm0p096p3pjfjbmjb7jij2pibcjfdia@4ax.com>
On 14 Oct 2004 22:23:55 GMT, Abigail <abigail@abigail.nl> wrote:
>I use 'system' or 'open "$cmd |"' often, even if there are Perl modules
>available to do the same. I've never had a problem with using 'system
Me too!
>mkdir => "-p", $dir', and it sure beats writing out the loop yourself. I
Me neither, as of the other post.
>always use 'system [rs]?cp|rsync' to copy files, as File::Copy is just
Well I've rarely enough had to actually copy files in Perl...
>broken (and doesn't have a tenth of the functionality of 'cp'). I can't
>be bothered to learn the semantics of File::Find - forking out to 'find'
>always does the trick for me.
Well, File::Find is a module, for one, that I rapidly get to
appreciate, not it's semantics is deeply etched in my cortex! At least
for this one no forking to 'find'! ;-)
>Perl is a glue language, and its ability to call other programs is a
>feature - a feature I treasure. And I don't have any religious feelings
Me neither!
>that urge me to write "pure Perl". As for portability, all my portability
>problems arise from Perl itself, not the tools I fork out to.
I think you're right. However my cmt was about thos people doing thing
like
my @list=`ls -1 *.txt | grep -ve '$foo' | xargs cat | sed ...`
I hope YOU don't do such things. In Perl, that is: shell programming
is quite another thing!
I must admit I've probably been over-suspicious about system() & C. in
the past. (But I like '-|' and '|-'-open()s very much!)
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 15 Oct 2004 09:25:49 -0500
From: "Toan Do" <ctd028@email.mot.com>
Subject: Need help - Perl-5.8.5 installation error
Message-Id: <ckomv9$jdq$1@newshost.mot.com>
We have Perl version 5.6.1 running ia64-linux, we need to either upgrade
or
install Perl version 5.8.5 on our system. During running the make command
after
submitting the command "sh Configure -de", the system generated the
following
message:
=====================================
usr/bin/ar rcu libperl.a perl.o gv.o toke.o perly.o op.o pad.o regcomp.o
dump.o util.o mg.o reentr.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o
pp_ctl.o pp_sys.o doop.o doio.o regexec.o utf8.o taint.o deb.o universal.o
xsutils.o globals.o perlio.o perlapi.o numeric.o locale.o pp_pack.o
pp_sort.o
rm -f opmini.c
cp op.c opmini.c
`sh cflags "optimize='-O2'" opmini.o` -DPERL_EXTERNAL_GLOB opmini.c
CCCMD =
cc -DPERL_CORE -c -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFI
LE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -Wall
rm -f opmini.c
cc -L/usr/local/lib -o miniperl \
miniperlmain.o opmini.o libperl.a -lnsl -ldl -lm -lcrypt -lutil -lc
./miniperl -w -Ilib -MExporter -e '<?>' || make minitest
Attempt to free unreferenced scalar: SV 0x600000000002fab0.
make: [extra.pods] Error 1 (ignored)
./miniperl -Ilib configpm configpm.tmp
make: *** [lib/Config.pm] Segmentation fault (core dumped)
===============================================
Can someone help us to re-build the Perl-5.8.5? Thx.
Here is the "uname -a" from our system:
uname -a
Linux halowtier1 2.4.20-telco-1.24.2-mckinley-smp #1 SMP Thu Apr 29 13:56:12
MDT 2004 ia64 unknown
I will provide the core file if need it.
Your helps are appreciated. Thx.
Toan
------------------------------
Date: 15 Oct 2004 10:14:13 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: One liner to produce string of n '?'s separated by commas ... ?
Message-Id: <cko7tl$ffa$3@mamenchi.zrz.TU-Berlin.DE>
Abigail <abigail@abigail.nl> wrote in comp.lang.perl.misc:
> Richard Gration (richard@zync.co.uk) wrote on MMMMLXI September MCMXCIII
> in <URL:news:ckj69c$4up$1@news.freedom2surf.net>:
> "" Anyone for golf?
> ""
> "" I can't think of anything shorter
> ""
> "" $n = 10;
> "" $vals = join ',', split //,'?' x $n;
> ""
> "" In case anyone was wondering, this _is_ SQL related ;-)
>
>
> $vals=("?,"x9)."?";
Short, but no good for $n == 0.
Anno
------------------------------
Date: 15 Oct 2004 14:44:15 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: References to an array in a foreach
Message-Id: <Xns95836D3A2B715asu1cornelledu@132.236.56.8>
Tad McClellan <tadmc@augustmail.com> wrote in
news:slrncmuiti.59s.tadmc@magna.augustmail.com:
> A. Sinan Unur <usa1@llenroc.ude.invalid> wrote:
>> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in
>> news:Xns9582A2C548DB0asu1cornelledu@132.236.56.8:
>>> David Green <mail.david@dsl.pipex.com> wrote in
>>> news:pan.2004.10.14.19.59.52.96858@dsl.pipex.com:
>
>>>> foreach $thiskey (@$thatkey) { # Here I try to dereference the
>>>> array print $thiskey . ","; # and presumably fail?
>
>> I do not know where the word 'array'
>> came from in my copy.
>
>
> Looks like it came from word-wrap to me.
Once again, you are right.
Comments in the right margin do have a tendency to wrap around. One ought
to be able to copy and paste the posted code without too much effort. The
commenting style above does not help with that.
Sinan.
------------------------------
Date: Fri, 15 Oct 2004 16:49:15 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Restricting a program to one running instance
Message-Id: <3oovm0p5dhkt74nloc6q2bgkpud8d1o076@4ax.com>
On 15 Oct 2004 09:50:04 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:
>If you are fighting a mix of ignorant and malicious users, you'll
>have to do more.
TY for your insightful cmts.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 15 Oct 2004 05:09:27 -0700
From: itsme@xs4all.nl (willem)
Subject: strange behaviour: array elements unexpectedly undeffed?
Message-Id: <43d1f04.0410150409.5e869800@posting.google.com>
running this script as
perl tst.pl < /dev/null
( or "perl tst.pl < nul" if you are running windows )
shows that the elements in the path array get modified if the loop
contains a '<>' operator.
is that a bug in perl? or am I missing something here.
I tried this with 5.8.3, 5.8.4, 5.8.5, various platforms ( freebsd,
linux, windows-cygwin, windows-activestate )
if you open a file, or pipe, and read it with <FH> the same thing
happens.
willem
-------------------------tst.pl
#!/usr/bin/perl -w
use strict;
#
# this script demonstrates how elements of the @path array
# get changed to 'undef' in the for loop when 'while(<>)'
# was executed somewhere in the loop
#
# I am not expecting @path to be changed by just looping over it.
#
my @path;
print "\n\n... array is fine just looping over it.\n\n";
@path=("usr", "bin");
writepath(\@path, "before first for");
for (@path) {
writepath(\@path, "in first for");
}
print "\n\n... array gets corrupted while reading from STDIN\n\n";
@path=("usr", "bin");
writepath(\@path, "before second for");
for (@path) {
writepath(\@path, "in second for");
while (<>) {
}
}
print "\n\n... and another element undeffed the next time\n\n";
writepath(\@path, "before third for");
for (@path) {
writepath(\@path, "in third for");
while (<>) {
}
}
sub writepath {
my $path= shift;
my $msg= shift;
print($msg, ": ", join(", ", map { sprintf("%d:%s", $_, defined
$path->[$_]?"ok":"NOTOK") } (0..$#$path) ), "\n");
}
------------------------------
Date: 15 Oct 2004 12:24:53 GMT
From: itsme@xs2.xs4all.nl (itsme(willem))
Subject: Re: strange behaviour: array elements unexpectedly undeffed?
Message-Id: <416fc195$0$34762$e4fe514c@news.xs4all.nl>
In article <43d1f04.0410150409.5e869800@posting.google.com>,
willem <itsme@xs4all.nl> wrote:
>is that a bug in perl? or am I missing something here.
found the problem, I should add 'local $_' before the while(<>).
still, I wonder if that should not happen implicitly?
willem
------------------------------
Date: Fri, 15 Oct 2004 14:23:58 +0200
From: Robert Sedlacek <phaylon@dunkelheit.at>
Subject: Re: strange behaviour: array elements unexpectedly undeffed?
Message-Id: <pan.2004.10.15.12.23.58.505555@dunkelheit.at>
itsme(willem) wrote:
> still, I wonder if that should not happen implicitly?
I do too, everytime I make that mistake...
g,
Robert
--
http://www.dunkelheit.at/
-<[::..::::..::::..]>-
------------------------------
Date: Fri, 15 Oct 2004 13:32:56 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: strange behaviour: array elements unexpectedly undeffed?
Message-Id: <ckofp5$t8t$1@sun3.bham.ac.uk>
willem wrote:
[ snip observation that $_ not implicitly localized by the while(<>)
construct ]
> is that a bug in perl? or am I missing something here.
You are missing the statement "The $_ variable is not implicitly
localized" in the documentation of the while(<>) construct.
http://search.cpan.org/~nwclark/perl-5.8.5/pod/perlop.pod#I/O_Operators
The documentation goes on to say: "You'll have to put a local $_; before
the loop if you want that to happen."
Do _not_ do this. Always localize *_ not $_. Getting into the habit of
doing local($_) will cause _very_ hard to find bugs when one day $_
happens to be an alias to an element of a tied agregate.
------------------------------
Date: Fri, 15 Oct 2004 14:00:48 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: strange behaviour: array elements unexpectedly undeffed?
Message-Id: <Xns958365DCBCEA9dkwwashere@216.168.3.30>
Brian McCauley <nobull@mail.com> wrote:
> willem wrote:
>
> [ snip observation that $_ not implicitly localized by the
> while(<>) construct ]
>
[snip]
> The documentation goes on to say: "You'll have to put a local $_;
> before the loop if you want that to happen."
>
> Do _not_ do this. Always localize *_ not $_. Getting into the
> habit of doing local($_) will cause _very_ hard to find bugs when
> one day $_ happens to be an alias to an element of a tied
> agregate.
Voice of experience? :-)
------------------------------
Date: Fri, 15 Oct 2004 14:34:25 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: strange behaviour: array elements unexpectedly undeffed?
Message-Id: <x7k6ts6ogz.fsf@mail.sysarch.com>
>>>>> "BM" == Brian McCauley <nobull@mail.com> writes:
BM> You are missing the statement "The $_ variable is not implicitly
BM> localized" in the documentation of the while(<>) construct.
BM> The documentation goes on to say: "You'll have to put a local $_;
BM> before the loop if you want that to happen."
BM> Do _not_ do this. Always localize *_ not $_. Getting into the habit
BM> of doing local($_) will cause _very_ hard to find bugs when one day $_
BM> happens to be an alias to an element of a tied agregate.
i like my solution better. i (almost) never use implict $_ in loops (or
anywhere). instead i use my variables which don't have scoping issues
and provide more information to the reader of the code. i only use $_
where forced to (map/grep) and in a few rare cases where it does help
the code quality.
i have never run into the nesting looped $_ bug because of this habit
and i find it amusing to see how often it traps newbies.
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: 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 7255
***************************************