in reply to Re^8: Compare hash with arrays and print
in thread Compare hash with arrays and print
When I try running my script with the following test set , it does not print anything in the output files, instead prints the data onto the screen!
This is most likely because with
my ($name) = /^([^\n]+)/;
you're extracting the entire header line as $name to be used as the hash key, but you have not set up your hash accordingly with keys such as "001.b1 gnl|ti|10009". In this case, none of the select FILE1 statements would execute, so STDOUT (connected to the screen) remains the default output handle for print.
Note that ^([^\n]+) would match everything from the beginning of the record up to the first newline, because the character class [^\n] says "match any character but a newline" (the ^ within the class negates).
Try one of the other suggestions, or adjust the regex as needed.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^10: Compare hash with arrays and print
by ad23 (Acolyte) on Jul 13, 2010 at 21:19 UTC | |
|
Re^10: Compare hash with arrays and print
by ad23 (Acolyte) on Jul 14, 2010 at 13:32 UTC |