On Jul 10, bob ackerman said:

>> All lists get auto-cast into a scalar, in scalar context.  An array slice
>> is merely a list of array elements.
>>
>>   $x = @y[2];
>>
>> is the same as
>>
>>   $x = ($y[2]);
>
>except you will get warnings on these lines.

Perl warns about @x[$i] because it was probably MEANT to be $x[$i].

>>   $x = @y[1,3,5];
>
>no warning on this. assumes you mean to only assign the last element. hmmm.

Perl doesn't warn about @x[$i,$j] because it was probably MEANT to be
@x[$i,$j].

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to