in reply to (tye)Re3: regexp searches over array slices
in thread regexp searches over array slices
This means that (scalar) context will be preserved by ^=~ (and other ^ constructs), correct?
It means that hyperoperators will distribute their own context (whatever it is) to each component of the operation, and then aggregate the results into a list.
For example:
$foo = @bar ^=~ /baz/; # each @bar[$i] =~ /baz in scalar context @foo = @bar ^=~ /baz/; # each @bar[$i] =~ /baz in list context
Hmmmm. That brings up an interesting point though. If the results were aggregated into an array rather than a list, then japhy's greppish interpretation of if (@var ^=~ /baz/) {...} might well be correct, after all.
I'm going to have to thrash this out with Larry. Thanks for raising the issue.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re4: regexp searches over array slices
by tye (Sage) on Nov 12, 2001 at 02:59 UTC | |
by TheDamian (Vicar) on Nov 15, 2001 at 01:09 UTC | |
by tye (Sage) on Nov 15, 2001 at 01:40 UTC | |
by TheDamian (Vicar) on Nov 16, 2001 at 01:34 UTC | |
by japhy (Canon) on Nov 16, 2001 at 01:46 UTC |