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.
In reply to Re^9: Compare hash with arrays and print
by almut
in thread Compare hash with arrays and print
by ad23
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |