Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: substitution question

by jkahn (Friar)
on Oct 17, 2002 at 18:20 UTC ( #206085=note: print w/replies, xml ) Need Help??

in reply to substitution question

Looks like you need to use eval, since you have an executing context.
my $SUBS='s/AA/BB/g'; $STR = "AAXXXAA"; eval "\$STR =~ $SUBS;"; print $STR, "\n";
On the other hand, if you don't like eval:
my $lh_sub = "AA"; my $rh_sub = "BB"; $STR = "AAXXXAA"; $STR =~ s/$lh_sub/$rh_sub/g; print $STR, "\n";

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://206085]
[marto]: good morning all
[Corion]: Good morning ;)
[marto]: meh, that's the last time I reply to finddata, I don't see an improvement in attitude or approach
Discipulus there are none so deaf as those who will not hear..
Discipulus who do not want to ear

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2017-03-30 07:04 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (353 votes). Check out past polls.