[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] @$a[0] = 5;



>>>>> "Ronald" == Ronald J Kimball <rjk@linguist.dartmouth.edu> writes:

Ronald> On Sun, Jul 04, 1999 at 04:08:42PM +0200, Roland Bauer wrote:
>> I found a similar code and I am quite sure the
>> programmer simply wanted to use "$a[0]", however,
>> it works and produces no warnings.
>> 
>> Can someone enlighten me, please?
>> 
>> 
>> use strict;
>> use diagnostics;
>> 
>> #my $a;
>> #my $b;
>> 
>> @$a[0] = 5;
>> @$b[0] = 6;
>> 
>> print @$a[0]; # prints "5"
>> 

Ronald> $a and $b are being used as references to arrays.

Ronald> Whether or not the programmer needed to do that depends on what is done
Ronald> with $a and $b elsewhere in the code.

But the point is really that $a and $b is "use strict" immune.  Try
the same example with $c and $d, and you'll see. :)

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe