$a = "this is a test"; %b = ( is => 'was' ); foreach my $key ( keys %b ) { $a =~ s/$key/$b{$key}/g; } print $a,"\n"; # output: thwas was a test
-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com
||
"You've left the lens cap of your mind on again, Pinky" - The Brain
In reply to Re: substituting with hash data
by Masem
in thread substituting with hash data
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |