Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^3: Perl oddities (s/// doesn't DWIM in map)

by heptadecagram (Novice)
on Mar 01, 2005 at 15:40 UTC ( #435480=note: print w/replies, xml ) Need Help??

in reply to Re^2: Perl oddities (s/// doesn't DWIM in map)
in thread Perl oddities

True. I'd like to see a switch:

my $modified = s/$pattern/$change_to/gr;

Where /r stands for 'replaced', or somesuch.

Replies are listed 'Best First'.
Re^4: Perl oddities (s/// doesn't DWIM in map)
by Roy Johnson (Monsignor) on Mar 01, 2005 at 18:50 UTC
    Would that be equivalent to
    (my $modified = $_) =~ s/$pattern/$change_to/g;
    s/$pattern/$change_to/g; my $modified = $_;

    Caution: Contents may have been coded under pressure.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://435480]
[LanX]: Bruce_G._Blair
[choroba]: as in embossed card?
[Discipulus]: ironically from his pubblications: "Can Disarmament Work?"
[erix]: when is the bird-brain's inauguration tweet?
[erix]: (wasn't augur something to with birds too?)
[erix]: augur
[erix]: ah, deciding on the the flight of birds - good idea ;)
[Discipulus]: as good as the Roma foundation

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (11)
As of 2017-01-20 13:01 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (174 votes). Check out past polls.