Steve Bertrand wrote: > Hi everyone, > > I've got a couple of simple questions. First, I know that the below line > is not correct, but instead of having someone correct it, I'd rather > learn more about the Perl debugger, and the map function. > > I'd like to replace 'h_' with 'hello_' in each key name in %hash, but > warnings indicate an odd number of elements, and the result is not what > I want: > > my %newhash = map { {$_ =~ s/h_/hello_/} } keys %hash;
Well, after realizing that the debugger does stop within each iteration of map, I was able to figure out that this is what I needed: my %hash = ( h_name => 'steveb', h_work => 'eagle.ca', ); my %newhash = map { $_ =~ s/h_/hello_/; ($_, $hash{$_}) } keys %hash; Steve
smime.p7s
Description: S/MIME Cryptographic Signature