in reply to Re: Inline substitution regex
in thread Inline substitution regex
Ok I almost understand it now.
It's hard to see s/this/that/ as an opperator! Because, err ... it looks like an expression, just like 3 + 4 is, in the following which prints 7 as expected.
my $var; print $var = 3 + 4 . "\n"; # Just for illustration!
Please do be a little more forgiving of beginners ;-) The print example code is just a clear way of illustrating my confusion. Here is the original code snippet with the incorrect line commented and the correct one as per your helpful explanations.
foreach (keys %{$ref_cookie}) { # push(@{$self->{cookies}}, {$_=~s/^-//}, $ref_cookie->{$_}}); push @{$self->{cookies}} , do{$_=~/^-(.*)/;$1}, $ref_cookie->{$_}); }
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Inline substitution regex
by ikegami (Patriarch) on Sep 29, 2009 at 05:14 UTC | |
by vitoco (Hermit) on Sep 29, 2009 at 13:26 UTC | |
by ikegami (Patriarch) on Sep 29, 2009 at 16:31 UTC | |
by vitoco (Hermit) on Sep 29, 2009 at 18:20 UTC | |
by ikegami (Patriarch) on Sep 29, 2009 at 23:50 UTC |