in reply to Replacing multiple matches
Something like this, perhaps:
#!/usr/bin/perl use strict; use warnings; my %replace = ( Not => 'Just', Stupid => 'Perl', ); my $string = "[Not] Another [Stupid] Hacker"; $string =~ s/\[([^\]]+)\]/$replace{$1}/g; print $string, $/; __OUTPUT__ Just Another Perl Hacker
|
|---|