Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^4: Reading through a file and checking for a specific string

by poj (Priest)
on Aug 20, 2013 at 17:41 UTC ( #1050217=note: print w/ replies, xml ) Need Help??


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


Comment on Re^4: Reading through a file and checking for a specific string
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1050217]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2014-09-16 17:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (36 votes), past polls