#!/opt/perl/5.8.7-32bit/bin/perl my $inFile = $ARGV[0]; my %CALHASH; my @CALARR; if(!$ARGV[0]) {exit;} open(FH, "<$inFile"); foreach $line () { chomp($line); #remove newline from end of line if($line =~ /(\w+_meas_.*)/) { ##($layer, $enc) = split(' ', $1); $layer = $1; #print "$layer, $enc\n"; if (exists $CALHASH{$layer}) { $CALHASH{$layer}{'freq'}++; } else { $CALHASH{$layer}{'freq'} = 1; } } } foreach $key (keys %CALHASH) { print "$CALHASH{$key}{'freq'} $key\n"; }