Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Not able to print out hash contents correctly

by poolpi (Hermit)
on Mar 24, 2009 at 15:50 UTC ( #752905=note: print w/replies, xml ) Need Help??


in reply to Not able to print out hash contents correctly

I would like to place each of these in a hash and increment a count

Your code could be simplified and fit your needs :

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my ( %h, $count ); while (<DATA>) { next unless /^>(\d+)/; $count++; defined $1 and $h{$1} = $count; } print Dumper \%h; __DATA__ >34513 -------------------------------MVAIIFDMDGVLYRG -----N-RAIPGVRELIEF-------LKE-R--------G------ >22476 ------------------------------ALKAVLVDLNGTLHI- --------AVPGAQEALKR--------------------------- >56832 ------MARCERLRGA-----ALRDVLG--RAQGVLFDCDGVLWNG- ----E-RAVPGAPELLER-------LAR------------------- >12543 ---------------------------E--QFDILLLDLDGVVYVG- ----D-RLLPGARRALRR----------------------------G >29078 ---------------------------------AVLFDIDGVLVLS- ----W-RAIPGAAETVRQ-------LTH-R--------G--------


hth,
PooLpi

'Ebry haffa hoe hab im tik a bush'. Jamaican proverb

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://752905]
help
Chatterbox?
[pryrt]: stevieb: going thru cblast to get caught up, I see that strawberry fixed their download hashes. Fast turnaround on that fix. :-)
[pryrt]: Are you going to tie the berrybrew expected hashes to their releases.json to keep it always up-to-date?

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2017-03-30 13:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (357 votes). Check out past polls.