Something else isn't right then. Using the data you supplied above (which you should copy to your actual question for future readers), and copy/pasting Athanasius' regex, here's what I get in %errors:
use warnings; use strict; my $string = "Return code is"; my %errors; while (<DATA>){ ++$errors{$1} if /\Q$string\E \s* : \s* (\d+) $ /x; } while (my ($k, $v) = each %errors){ print "$k: $v\n"; } __DATA__ 2015/04/06 12:38:15 (9):(5564) Return code is :55 2015/04/06 12:38:15 (9):(6600) Return code is :55 2015/04/06 12:41:31 (9):(3604) Return code is :1
Output:
1: 1 55: 2
In reply to Re^3: Can't get hash keys to print
by stevieb
in thread Can't get hash keys to print
by Daren
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |