http://www.perlmonks.org?node_id=1050217


in reply to Re^3: Reading through a file and checking for a specific string
in thread Reading through a file and checking for a specific string

Store the description in a hash not an array.

#!/usr/bin/perl use strict; # test data my %counts = ( AB => 135172, AC => 0, AD => 64, AE => 0, FG => 248782, ); my %descr = ( AB => 'ABYUSID', FG => 'FGIUIO', AD => 'ADHGUT', AE => 'AERUTOT', AC => 'ACVHGTI', ); for my $type ( sort keys %counts ) { # add sort next if ($counts{$type} == 0); # skip zeros print "$type($descr{$type})\t: $counts{$type}\n"; # add descr }
poj