No such thing as a small change | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Answering your second question, you have two syntax errors in the provided code. First, by including my in your assignment statement, you are masking the $value variable declared in your while statement (This will get caught if you use strict;use warnings). Second, you are overwriting your %copy hash on every iteration with the new key-value pair. What you mean is likely:
This can be done in one line as: my %copy = reverse %hash; Be aware that this will not behave well if you have repeat values. Update: This is addressed in perlfaq4. In reply to Re: insert label into file
by kennethk
|
|