[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
Re: [Fwd: Perl bug?]
Though the forwarded message did not replicate itself in this response, I
will paraphrase it:
$a = reverse $b; # 1
($a) = reverse $b; # 2
In case 1, the left hand side is in SCALAR context, meaning reverse() is
to concatenate the arguments it gets (it only got one in this case), and
reverse them character-by-character, and return a string.
In case 2, the left hand side is in LIST context, meaing reverse() is to
reverse the order of the arguments it gets (still only has one), and
return the ARGUMENTS in this reversed orderd.
All this is explained in 'perldoc -f reverse'.
--
MIDN 4/C PINYAN, USNR, NROTCURPI http://www.pobox.com/~japhy/
jeff pinyan: japhy@pobox.com perl stuff: japhy+perl@pobox.com
"The Art of Perl" http://www.pobox.com/~japhy/book/
CPAN ID: PINYAN http://www.perl.com/CPAN/authors/id/P/PI/PINYAN/
PerlMonth - An Online Perl Magazine http://www.perlmonth.com/
- References to:
-
Vincent Chang <vchang@micron.com>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]