[30132] in Perl-Users-Digest
Perl-Users Digest, Issue: 1375 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 20 03:09:41 2008
Date: Thu, 20 Mar 2008 00:09:08 -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 Mar 2008 Volume: 11 Number: 1375
Today's topics:
Re: called too early to check prototype at <rvtol+news@isolution.nl>
Re: Is substr only way of getting nth character of stri <john@castleamber.com>
Re: Is substr only way of getting nth character of stri <lonewolf@well.com>
Re: Is substr only way of getting nth character of stri <ben@morrow.me.uk>
Re: Is substr only way of getting nth character of stri <lonewolf@well.com>
new CPAN modules on Thu Mar 20 2008 (Randal Schwartz)
pattern match <venkatesh.sourav@gmail.com>
Re: pattern match <noreply@gunnar.cc>
Re: pattern match venkatesh.naughty@gmail.com
Re: very strange bug (in perl?) <benkasminbullock@gmail.com>
Re: very strange bug (in perl?) <noreply@gunnar.cc>
Re: very strange bug (in perl?) dummy@phony.info
Re: very strange bug (in perl?) dummy@phony.info
Re: very strange bug (in perl?) dummy@phony.info
Re: very strange bug (in perl?) dummy@phony.info
Re: very strange bug (in perl?) dummy@phony.info
Re: very strange bug (in perl?) <benkasminbullock@gmail.com>
Re: very strange bug (in perl?) <kkeller-usenet@wombat.san-francisco.ca.us>
Re: very strange bug (in perl?) <noreply@gunnar.cc>
Re: very strange bug (in perl?) dummy@phony.info
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 20 Mar 2008 03:43:04 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: called too early to check prototype at
Message-Id: <frsmnk.1d4.1@news.isolution.nl>
Jürgen Exner schreef:
> for my $count (0..@dbset-1)
Alternatives:
for my $count ( 0 .. $#dbset )
for my $count ( $[ .. $#dbset )
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 20 Mar 2008 02:22:55 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Is substr only way of getting nth character of string?
Message-Id: <Xns9A66CF5616DABcastleamber@130.133.1.4>
Ben Bullock <benkasminbullock@gmail.com> wrote:
> On Thu, 20 Mar 2008 00:06:39 +0000, Uri Guttman wrote:
>>>>>>> "RH" == Robbie Hatley <see.my.signature@for.my.email.address>
>>>>>>> writes:
>
>> RH> the only array I really need is the entire 96-character
>> RH> character set.
>
> my @x = map chr, 33..127;
>
>> typing in the alphabet is more error prone than just 'a' and 'z'.
>
> Well, typing the entire alphabet in one go certainly is error-prone if
> you're six or seven years old. But eight year olds or above probably can
> handle it.
I LOLed at your reply to this one :-D
--
John
http://johnbokma.com/
------------------------------
Date: Wed, 19 Mar 2008 22:12:21 -0800
From: "Robbie Hatley" <lonewolf@well.com>
Subject: Re: Is substr only way of getting nth character of string?
Message-Id: <DP2dnUum0Yyab3zanZ2dnUVZ_gednZ2d@giganews.com>
"Ben Bullock" wrote:
> my @x = map chr, 33..127;
Hmmm. Ok, cool technique. But I really need a slightly
different assortment: tab, space, and graphicals. The
33-127 range is 95 chars (not 96), includes DEL, excludes
tab and space. I need (9, 32..126).
I'm not familiar with "map" yet. Lemme look that up in
ch29....
:::riffles through camel book:::
Hmmm...
map EXPR, LIST
Applies EXPR to each element of LIST and returns list of
results.
Cool.
Ok, I'd need something like:
my @Charset = map chr, 9, 32..126;
:::compiles and runs it:::
Yep, that works great. Thanks!
Now, I just need to figure out how to do random permutations
of arrays...
--
Cheers,
Robbie Hatley
lonewolf aatt well dott com
www dott well dott com slant user slant lonewolf slant
------------------------------
Date: Thu, 20 Mar 2008 05:35:08 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Is substr only way of getting nth character of string?
Message-Id: <cl99b5-pe7.ln1@osiris.mauzo.dyndns.org>
Quoth "Robbie Hatley" <lonewolf@well.com>:
>
> Now, I just need to figure out how to do random permutations
> of arrays...
use List::Util qw/shuffle/;
my @random = shuffle 0..40;
Ben
------------------------------
Date: Wed, 19 Mar 2008 23:13:02 -0800
From: "Robbie Hatley" <lonewolf@well.com>
Subject: Re: Is substr only way of getting nth character of string?
Message-Id: <AY2dnW_urvSynX_anZ2dnUVZ_hCdnZ2d@giganews.com>
Ben Morrow wrote:
> Quoth "Robbie Hatley" <lonewolf@well.com>:
> >
> > Now, I just need to figure out how to do random permutations
> > of arrays...
>
> use List::Util qw/shuffle/;
>
> my @random = shuffle 0..40;
Cool! One line, eh? Ok, In the time since I wrote that,
I *did* manage to create two different array permutation
routines, but they weren't one-liners.
The first scheme I came up with kept generating random
chars from a fixed charset and pushing them onto a
destination array, IF they weren't already in the array,
until the array had 96 elements. HORRIBLY inefficient,
because half the time the random char has to be
abandoned because it's already in the destination.
The second routine I came up with I like much better:
my @Charset = map chr, 9, 32..126;
my @TempCharset = @Charset;
my @PermCharset;
while (@TempCharset > 0)
{
my $RandomInt = rand_int(0, @TempCharset - 1);
my $RandomChar = $TempCharset[$RandomInt];
push @PermCharset, $RandomChar;
delete $TempCharset[$RandomInt];
}
print @PermCharset, "\n";
It basically grabs characters at random indexs from a source
array and pushes them onto an empty destination array,
deleting the pushed character from the source each time,
until the source is empty. No wasted steps.
But i suppose instead of the while loop i could do
@PermCharset = shuffle @Charset;
Thanks for the tip!
--
Cheers,
Robbie Hatley
lonewolf aatt well dott com
www dott well dott com slant user slant lonewolf slant
------------------------------
Date: Thu, 20 Mar 2008 04:42:17 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Mar 20 2008
Message-Id: <Jy0IEH.GGw@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
API-Plesk-1.01
http://search.cpan.org/~nrg/API-Plesk-1.01/
OOP interface to the Plesk XML API (http://www.parallels.com/en/products/plesk/).
----
App-Cmd-0.013
http://search.cpan.org/~rjbs/App-Cmd-0.013/
write command line apps with less suffering
----
Asterisk-config-0.95
http://search.cpan.org/~hoowa/Asterisk-config-0.95/
the Asterisk config read and write module.
----
B-Debugger-0.01_02
http://search.cpan.org/~rurban/B-Debugger-0.01_02/
optree debugger
----
CORBA-IDL-2.63
http://search.cpan.org/~perrad/CORBA-IDL-2.63/
----
CPAN-Site-0.18
http://search.cpan.org/~markov/CPAN-Site-0.18/
CPAN.pm subclass for adding site local modules
----
Calendar-List-0.19
http://search.cpan.org/~barbie/Calendar-List-0.19/
A module for creating date lists
----
Catalyst-Model-SWISH-0.03
http://search.cpan.org/~karman/Catalyst-Model-SWISH-0.03/
Catalyst model for Swish-e
----
Config-AutoConf-0.06
http://search.cpan.org/~ambs/Config-AutoConf-0.06/
A module to implement some of AutoConf macros in pure perl.
----
Config-Model-Itself-0.102
http://search.cpan.org/~ddumont/Config-Model-Itself-0.102/
Model of Config::Model
----
Continuity-0.991
http://search.cpan.org/~awwaiid/Continuity-0.991/
Abstract away statelessness of HTTP, for stateful Web applications
----
DBD-Pg-2.3.0
http://search.cpan.org/~turnstep/DBD-Pg-2.3.0/
PostgreSQL database driver for the DBI module
----
Devel-NYTProf-0.09
http://search.cpan.org/~akaplan/Devel-NYTProf-0.09/
line-by-line code profiler and report generator
----
Devel-PartialDump-0.01
http://search.cpan.org/~nuffin/Devel-PartialDump-0.01/
Partial dumping of data structures, optimized for argument printing.
----
Fuse-0.09_3
http://search.cpan.org/~dpavlin/Fuse-0.09_3/
write filesystems in Perl using FUSE
----
Games-SGF-0.02
http://search.cpan.org/~whitcode/Games-SGF-0.02/
A general SGF parser
----
Google-Adwords-v1.8.2
http://search.cpan.org/~rohan/Google-Adwords-v1.8.2/
an interface which abstracts the Google Adwords SOAP API
----
HTTP-Server-Simple-Static-0.07
http://search.cpan.org/~sjquinney/HTTP-Server-Simple-Static-0.07/
Serve static files with HTTP::Server::Simple
----
JSON-XS-2.1
http://search.cpan.org/~mlehmann/JSON-XS-2.1/
JSON serialising/deserialising, done correctly and fast
----
Lingua-JA-Fold-0.08
http://search.cpan.org/~hata/Lingua-JA-Fold-0.08/
to fold a Japanese text.
----
Lingua-Jspell-1.50_01
http://search.cpan.org/~ambs/Lingua-Jspell-1.50_01/
Perl interface to the jspell morphological analyser.
----
Lingua-Jspell-1.50_02
http://search.cpan.org/~ambs/Lingua-Jspell-1.50_02/
Perl interface to the Jspell morphological analyser.
----
Locale-Currency-Format-1.25
http://search.cpan.org/~tnguyen/Locale-Currency-Format-1.25/
Perl functions for formatting monetary values
----
Log-Syslog-Abstract-1.100
http://search.cpan.org/~doneill/Log-Syslog-Abstract-1.100/
Use any available syslog API
----
MOBY-1.00
http://search.cpan.org/~ekawas/MOBY-1.00/
API for hosting and/or communicating with a MOBY Central registry
----
MOBY-1.01
http://search.cpan.org/~ekawas/MOBY-1.01/
API for hosting and/or communicating with a MOBY Central registry
----
Module-Faker-0.004
http://search.cpan.org/~rjbs/Module-Faker-0.004/
build fake dists for testing CPAN tools
----
NCGI-0.07
http://search.cpan.org/~mlawren/NCGI-0.07/
A Common Gateway Interface (CGI) Class
----
Net-Shoutcast-Admin-0.02
http://search.cpan.org/~bigpresh/Net-Shoutcast-Admin-0.02/
administration of Shoutcast servers
----
Parse-Marpa-0.205_000
http://search.cpan.org/~jkegl/Parse-Marpa-0.205_000/
(Alpha) Earley's algorithm with LR(0) precomputation
----
RDF-Query-2.000
http://search.cpan.org/~gwilliams/RDF-Query-2.000/
An RDF query implementation of SPARQL/RDQL in Perl for use with RDF::Redland and RDF::Core.
----
RDF-Trine-0.105
http://search.cpan.org/~gwilliams/RDF-Trine-0.105/
An RDF Framework for Perl.
----
Rinchi-CPlusPlus-Preprocessor-0.02
http://search.cpan.org/~bmames/Rinchi-CPlusPlus-Preprocessor-0.02/
A C++ to XML SAX preprocessor.
----
String-Splitter-0.3
http://search.cpan.org/~bbkr/String-Splitter-0.3/
Find all possible string splits and unique substrings.
----
TM-1.32
http://search.cpan.org/~drrho/TM-1.32/
Topic Maps, Base Class
----
Term-Title-0.03
http://search.cpan.org/~dagolden/Term-Title-0.03/
Portable API to set the terminal titlebar
----
Tk-Pod-0.9938_51
http://search.cpan.org/~srezic/Tk-Pod-0.9938_51/
Pod browser toplevel widget
----
Variable-Magic-0.13
http://search.cpan.org/~vpit/Variable-Magic-0.13/
Associate user-defined magic to variables from Perl.
----
WWW-Tumblr-1
http://search.cpan.org/~damog/WWW-Tumblr-1/
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Wed, 19 Mar 2008 22:29:29 -0700 (PDT)
From: "Venkatesh can....can..." <venkatesh.sourav@gmail.com>
Subject: pattern match
Message-Id: <078907a6-cdac-4c4b-87ea-9aceba45a325@i12g2000prf.googlegroups.com>
$var="{' venkat'}->{'no'}->{'yes'}";
i want to get the "yes" token;
if i use
$var=~/\{'( .* )\}$/
i get venkat'}->{'no'}->{'yes
how to get the "yes" token...
------------------------------
Date: Thu, 20 Mar 2008 07:02:54 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: pattern match
Message-Id: <64ed0pF2bmuoiU1@mid.individual.net>
Venkatesh can....can... wrote:
> $var="{' venkat'}->{'no'}->{'yes'}";
> i want to get the "yes" token;
> if i use
> $var=~/\{'( .* )\}$/
> i get venkat'}->{'no'}->{'yes
No you don't. You get nothing, because that regex does not match.
However, with the /x modifier it matches and assigns the string you
mention to $1.
> how to get the "yes" token...
One way:
$var =~ /.+{'(.+)'}$/;
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Wed, 19 Mar 2008 23:18:01 -0700 (PDT)
From: venkatesh.naughty@gmail.com
Subject: Re: pattern match
Message-Id: <ba75f6fb-5e90-42c6-ab10-92a5331bc529@s12g2000prg.googlegroups.com>
On Mar 20, 11:02=A0am, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
> Venkatesh can....can... wrote:
> > $var=3D"{' venkat'}->{'no'}->{'yes'}";
> > i want to get the "yes" token;
> > if i use
> > $var=3D~/\{'( .* )\}$/
> > i get venkat'}->{'no'}->{'yes
>
> No you don't. You get nothing, because that regex does not match.
> However, with the /x modifier it matches and assigns the string you
> mention to $1.
>
> > how to get the "yes" token...
>
> One way:
>
> =A0 =A0 =A0$var =3D~ /.+{'(.+)'}$/;
>
> --
> Gunnar Hjalmarsson
> Email:http://www.gunnar.cc/cgi-bin/contact.pl
@gunnar
thanks it works but how?
the first .+ is greedy know? it 'll match up to the end right?
------------------------------
Date: Thu, 20 Mar 2008 01:19:10 +0000 (UTC)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: very strange bug (in perl?)
Message-Id: <frse2e$d6t$5@ml.accsnet.ne.jp>
On Wed, 19 Mar 2008 16:41:19 -0700, dummy wrote:
> $ow{$i} = \@in;
The two lines like this cause the problem. When a program uses "my @in"
inside a loop, it creates a new @in each time it goes around the loop.
Usually if you have
my $something
inside a loop, Perl destroys it at the end of the loop, but here you have
taken a reference to it, so Perl keeps it.
However, when you put "my @in" outside the loop, the above reference
points to the same old @in each time, so \@in points to the same old
thing each time, hence your problem.
You can fix this by copying the whole @in array into another array:
my @crud = @in;
$ow{$i} = \@crud;
But that may not be the optimal solution.
------------------------------
Date: Thu, 20 Mar 2008 02:37:04 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: very strange bug (in perl?)
Message-Id: <64dtebF2av1n8U1@mid.individual.net>
Ben Bullock wrote:
> when you put "my @in" outside the loop, the above reference
> points to the same old @in each time, so \@in points to the same old
> thing each time, hence your problem.
>
> You can fix this by copying the whole @in array into another array:
>
> my @crud = @in;
> $ow{$i} = \@crud;
Or simpler:
$ow{$i} = [ @in ];
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Wed, 19 Mar 2008 18:40:42 -0700
From: dummy@phony.info
Subject: Re: very strange bug (in perl?)
Message-Id: <vuf3u3p2fdh12iecnsvbi0m36uraulg22c@4ax.com>
On Thu, 20 Mar 2008 00:02:28 +0000 (UTC), Ben Bullock
<benkasminbullock@gmail.com> wrote:
>On Wed, 19 Mar 2008 16:41:19 -0700, dummy wrote:
>
>> Please don't sneer and laugh, but I think I've found a bug in perl
>> itself.
>
>I am using Perl on linux:
>
>ben ~ 525 $ perl --version
>
>This is perl, v5.10.0 built for i686-linux
>
>I changed only the top line of your program to "#!/usr/bin/perl" and the
>output was as follows:
>
>ben ~ 524 $ ./bug.pl
>Semicolon seems to be missing at ./bug.pl line 25.
>"my" variable $q masks earlier declaration in same scope at ./bug.pl line
>28.
>"my" variable $q masks earlier declaration in same scope at ./bug.pl line
>29.
>"my" variable $q masks earlier declaration in same scope at ./bug.pl line
>30.
>"my" variable @in masks earlier declaration in same scope at ./bug.pl
>line 32.
>"my" variable @in masks earlier declaration in same scope at ./bug.pl
>line 34.
>"my" variable $q masks earlier declaration in same scope at ./bug.pl line
>34.
>"my" variable %ow masks earlier declaration in same scope at ./bug.pl
>line 61.
>"state" variable @_ masks earlier declaration in same scope at ./bug.pl
>line 77.
>syntax error at ./bug.pl line 26, near ") # works if i comment out this
>line and put 'my' below -+
># print "old\n"; |
># display(); |
>INPUT"
>syntax error at ./bug.pl line 56, near "}"
>Can't use global @_ in "my" at ./bug.pl line 68, near "= @_"
>syntax error at ./bug.pl line 74, near "}"
>Can't use global @_ in "my" at ./bug.pl line 77, near "= @_"
>BEGIN not safe after errors--compilation aborted at ./bug.pl line 78.
>
>I think some people might be tempted to laugh.
Obviously a cut-and-paste typo. Otherwise I would have no output. Fix
the missing semicolon and try again. That is, if you want to do more
than ridicule.
------------------------------
Date: Wed, 19 Mar 2008 18:42:01 -0700
From: dummy@phony.info
Subject: Re: very strange bug (in perl?)
Message-Id: <j5g3u3lsacffujqfknnqg2s272buotnt38@4ax.com>
On Thu, 20 Mar 2008 01:37:22 +0100, Gunnar Hjalmarsson
<noreply@gunnar.cc> wrote:
>Ben Bullock wrote:
>> I changed only the top line of your program to "#!/usr/bin/perl" and the
>> output was as follows:
>>
>> ben ~ 524 $ ./bug.pl
>> Semicolon seems to be missing at ./bug.pl line 25.
>> "my" variable $q masks earlier declaration in same scope at ./bug.pl line
>> 28.
>> "my" variable $q masks earlier declaration in same scope at ./bug.pl line
>> 29.
>> "my" variable $q masks earlier declaration in same scope at ./bug.pl line
>> 30.
>> "my" variable @in masks earlier declaration in same scope at ./bug.pl
>> line 32.
>> "my" variable @in masks earlier declaration in same scope at ./bug.pl
>> line 34.
>> "my" variable $q masks earlier declaration in same scope at ./bug.pl line
>> 34.
>> "my" variable %ow masks earlier declaration in same scope at ./bug.pl
>> line 61.
>> "state" variable @_ masks earlier declaration in same scope at ./bug.pl
>> line 77.
>> syntax error at ./bug.pl line 26, near ") # works if i comment out this
>> line and put 'my' below -+
>> # print "old\n"; |
>> # display(); |
>> INPUT"
>> syntax error at ./bug.pl line 56, near "}"
>> Can't use global @_ in "my" at ./bug.pl line 68, near "= @_"
>> syntax error at ./bug.pl line 74, near "}"
>> Can't use global @_ in "my" at ./bug.pl line 77, near "= @_"
>> BEGIN not safe after errors--compilation aborted at ./bug.pl line 78.
>>
>> I think some people might be tempted to laugh.
>
>That's not fair. By just adding the missing semicolon, as the first
>error message mentions, the code compiles.
Thank you, Gunnar.
------------------------------
Date: Wed, 19 Mar 2008 18:50:01 -0700
From: dummy@phony.info
Subject: Re: very strange bug (in perl?)
Message-Id: <rag3u3lnp10phc9ng5n599e3864cu7j2j8@4ax.com>
On Thu, 20 Mar 2008 01:19:10 +0000 (UTC), Ben Bullock
<benkasminbullock@gmail.com> wrote:
>On Wed, 19 Mar 2008 16:41:19 -0700, dummy wrote:
>
>> $ow{$i} = \@in;
>
>The two lines like this cause the problem. When a program uses "my @in"
>inside a loop, it creates a new @in each time it goes around the loop.
>Usually if you have
>
>my $something
>
>inside a loop, Perl destroys it at the end of the loop, but here you have
>taken a reference to it, so Perl keeps it.
>
>However, when you put "my @in" outside the loop, the above reference
>points to the same old @in each time, so \@in points to the same old
>thing each time, hence your problem.
>
>You can fix this by copying the whole @in array into another array:
>
> my @crud = @in;
> $ow{$i} = \@crud;
>
>But that may not be the optimal solution.
Thank you for the explanation. I was able to fix it by moving the 'my'
declaration inside the loop, where it belonged, but I couldn't figure
out why that fixed it. I am HAPPY to find that there is no bug in perl.
------------------------------
Date: Wed, 19 Mar 2008 18:51:02 -0700
From: dummy@phony.info
Subject: Re: very strange bug (in perl?)
Message-Id: <9ng3u39tqpvpi4ik50m93raqtridfjmupa@4ax.com>
On Thu, 20 Mar 2008 02:37:04 +0100, Gunnar Hjalmarsson
<noreply@gunnar.cc> wrote:
>Ben Bullock wrote:
>> when you put "my @in" outside the loop, the above reference
>> points to the same old @in each time, so \@in points to the same old
>> thing each time, hence your problem.
>>
>> You can fix this by copying the whole @in array into another array:
>>
>> my @crud = @in;
>> $ow{$i} = \@crud;
>
>Or simpler:
>
> $ow{$i} = [ @in ];
Thanks again!
------------------------------
Date: Wed, 19 Mar 2008 19:23:24 -0700
From: dummy@phony.info
Subject: Re: very strange bug (in perl?)
Message-Id: <9gi3u3dmi9vhs1ikhjgto8gd35o77k7tip@4ax.com>
On Thu, 20 Mar 2008 02:37:04 +0100, Gunnar Hjalmarsson
<noreply@gunnar.cc> wrote:
>Ben Bullock wrote:
>> when you put "my @in" outside the loop, the above reference
>> points to the same old @in each time, so \@in points to the same old
>> thing each time, hence your problem.
>>
>> You can fix this by copying the whole @in array into another array:
>>
>> my @crud = @in;
>> $ow{$i} = \@crud;
>
>Or simpler:
>
> $ow{$i} = [ @in ];
If that same code was used in several places in the same scope would it
create more than one anonymous array?
------------------------------
Date: Thu, 20 Mar 2008 03:26:49 +0000 (UTC)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: very strange bug (in perl?)
Message-Id: <frslhp$ofl$1@ml.accsnet.ne.jp>
On Thu, 20 Mar 2008 02:37:04 +0100, Gunnar Hjalmarsson wrote:
>> You can fix this by copying the whole @in array into another array:
>>
>> my @crud = @in;
>> $ow{$i} = \@crud;
> Or simpler:
>
> $ow{$i} = [ @in ];
@{$ow{$i}} = @in;
My cruddy excuse for my original method is its benefit of being clearer
for a learner. As you point out it has the deficiency of creating an
unnecessary variable @crud instead of using an anonymous array.
------------------------------
Date: Wed, 19 Mar 2008 21:50:54 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: very strange bug (in perl?)
Message-Id: <f279b5x3h.ln2@goaway.wombat.san-francisco.ca.us>
On 2008-03-20, dummy@phony.info <dummy@phony.info> wrote:
>
> Thank you for the explanation. I was able to fix it by moving the 'my'
> declaration inside the loop, where it belonged, but I couldn't figure
> out why that fixed it. I am HAPPY to find that there is no bug in perl.
There are bugs in Perl, but if you'd read the Posting Guidelines, you'd
have realized that yours most likely was not.
--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 Mar 2008 06:47:26 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: very strange bug (in perl?)
Message-Id: <64ec3pF2be7dpU1@mid.individual.net>
dummy@phony.info wrote:
> On Thu, 20 Mar 2008 02:37:04 +0100, Gunnar Hjalmarsson
> <noreply@gunnar.cc> wrote:
>>
>> $ow{$i} = [ @in ];
>
> If that same code was used in several places in the same scope would it
> create more than one anonymous array?
Yes. Each occurrence of [ @in ] would _copy_ @in into a new anonymous
array, to which $ow{$i} would become a reference. (I'm assuming that the
value of $i would not be the same.)
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Wed, 19 Mar 2008 23:08:29 -0700
From: dummy@phony.info
Subject: Re: very strange bug (in perl?)
Message-Id: <fkv3u3pmqtc4ejj2qfrai78piboeg3hcvh@4ax.com>
On Wed, 19 Mar 2008 21:50:54 -0700, Keith Keller
<kkeller-usenet@wombat.san-francisco.ca.us> wrote:
>On 2008-03-20, dummy@phony.info <dummy@phony.info> wrote:
>>
>> Thank you for the explanation. I was able to fix it by moving the 'my'
>> declaration inside the loop, where it belonged, but I couldn't figure
>> out why that fixed it. I am HAPPY to find that there is no bug in perl.
>
>There are bugs in Perl, but if you'd read the Posting Guidelines, you'd
>have realized that yours most likely was not.
>
>--keith
Well, I did quite a bit of reading and sweating before posting, but was
still puzzled. I admit I shouldn't have used the language I did.
But I _did_ learn quite a bit from this exchange.
------------------------------
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 1375
***************************************