in reply to Re: Cool example of list assignment usage
in thread Cool example of list assignment usage
Okay, that is pretty confusing. Wouldn't you expect the outer parentheses to return $first in list context, rather than the number of matches from the grep?
No, I don't find it confusing at all, but maybe that's because while not claiming in any way to be a Perl guru or anything, fundamental bits and pieces of Perl semantics are deeply etched in my cortex. I don't expect the outer parens to return $first in list context because it's the same mechanism by virtue of which the (sometimes) so-called "goatse operator" (do not follow link if you don't already know and are easily impressed) =()= works. No NASA technology, just Perl: and then I find Perl semantics to be intuitive in most situations, with the exception of some corner cases, with the current one possibly falling in the latter category. But for some reasons it's still intuitive to me and, I believe, to most Perl programmers with a bare minimum of confidence with the language.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Cool example of list assignment usage
by perrin (Chancellor) on Jul 23, 2007 at 15:54 UTC | |
by blazar (Canon) on Jul 23, 2007 at 17:46 UTC | |
by perrin (Chancellor) on Jul 23, 2007 at 17:56 UTC | |
by blazar (Canon) on Jul 23, 2007 at 17:59 UTC |