in reply to Pattern Matching: Case-Conservation
Something like this?
my %hash = ( 'foo' => 'bar', 'Foo' => 'Bar', 'FOO' => 'BAR', ); my $string = "foo Foo foo FOO"; print "old: $string\n"; foreach (keys %hash) { $string =~ s/($_)/$hash{$1}/g; } print "new: $string\n";
old: foo Foo foo FOO new: bar Bar bar BAR
Jason L. Froebe
Update: I should have read the question more carefully. Follow the second reply (written by Duff).. this one would do better for having a list of tokens that would be replaced with the real values.
No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1
|
|---|