Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: What is wrong in this code???

by Anonymous Monk
on Dec 07, 2012 at 21:33 UTC ( #1007828=note: print w/replies, xml ) Need Help??


in reply to Re^2: What is wrong in this code???
in thread What is wrong in this code???

use strict; use warnings; while (<>) { my %sequences; for my $char ( split '', (split)[1] ) { $sequences{$char}++; } print "$_ => $sequences{$_}", "\n" for keys %sequences; }

Note how I declared the hash inside the loop. Scoping variables correctly is the easiest way to reset them.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007828]
help
Chatterbox?
[Eily]: do you pronunce that /xju:mən/ then ?
[Eily]: that's not what I'd call a silent h :)
[LanX]: see soundfile https://en. wiktionary.org/ wiki/human# Pronunciation
[Your Mother]: Just Another Perl 'Acker.
[LanX]: I pronounce it 'juːmən'
[Your Mother]: Hey, let's not bring antisemitism into the conversation.
[LanX]: for centuries posh English speakers tried to approach French, that's where all the trouble starts
[Eily]: Just another Perl coeurs
[Eily]: (perl with hearts, 'Acker with a French accent is pronunced like coeurs)
[LanX]: IMHO 'ju' for 'u' happens in English where they can't pronounce the French u (or German )

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



    Results (320 votes). Check out past polls.