in reply to Can we make $& better?
There is a difference:
$\ = "\n"; my $s = 'abcdefghij'; $s =~ /def/; print $&; # def print substr($s, $-[0], $+[0] - $-[0]); # def $s = '1234567890'; print $&; # def print substr($s, $-[0], $+[0] - $-[0]); # 456
Does it matter? Maybe. Switching could break existing code.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Can we make $& better?
by Anno (Deacon) on Sep 06, 2007 at 19:40 UTC |