in reply to Re: (RFC) Arrays: A Tutorial/Reference
in thread (RFC) Arrays: A Tutorial/Reference
Parentheses don't create lists
I guess they do. At least they force list context:
qwurx [shmem] ~ > perl -le '$_ = "foo bar baz"; $c = /\w+/g; print $c' 1 qwurx [shmem] ~ > perl -le '$_ = "foo bar baz"; $c = () = /\w+/g; prin +t $c' 3
<update>
The first line only prints out wether the match succeeded. The second form forces the match to be done in list context. The resulting list is then evaluated in scalar context. Or is that also a kind of disambiguation (of the match operator)?
qwurx [shmem] ~ > perl -le '$_ = "foo bar baz"; $c = (/\w+/g); print $ +c' 1
Hmm.. here they obviously don't force list context?
</update>
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: (RFC) Arrays: A Tutorial/Reference
by chromatic (Archbishop) on Jan 13, 2007 at 19:23 UTC | |
by shmem (Chancellor) on Jan 13, 2007 at 20:16 UTC | |
by rir (Vicar) on Jan 15, 2007 at 03:52 UTC | |
by shmem (Chancellor) on Jan 15, 2007 at 08:24 UTC | |
by rir (Vicar) on Jan 17, 2007 at 01:41 UTC |