hotshot has asked for the wisdom of the Perl Monks concerning the following question:
Anyone?my $str = 'I have a green shirt and a blue hat'; my ($YELLOW, $RED) = qw(yellow red); # I wish that could have worked somehow $str = tr/green,blue/$yellow,$RED/; # requested result print $str; # would print: I have a yellow shirt and a red hat
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: tr///
by japhy (Canon) on Jan 24, 2002 at 21:42 UTC | |
|
Re: tr///
by archen (Pilgrim) on Jan 24, 2002 at 22:53 UTC |