Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: alphabet counting

by Anonymous Monk
on Jun 02, 2012 at 14:09 UTC ( [id://974019]=note: print w/replies, xml ) Need Help??


in reply to Re: alphabet counting
in thread alphabet counting

i have problem with hash printing !!!

Replies are listed 'Best First'.
Re^3: alphabet counting
by sauoq (Abbot) on Jun 02, 2012 at 14:19 UTC
    i have problem with hash printing !!!

    You could guess that any such problems could be easily resolved... did you try something like this:

    print "$k => $h{$k}\n" for my $k (sort keys %h);
    ?

    -sauoq
    "My two cents aren't worth a dime.";

      Hmm...

      my %h = ( a => 1, b => 2, c => 3 ); print "$k => $h{$k}\n" for my $k (sort keys %h);

      Output:

      syntax error at D:\progs\perl\junk.pl line 5, near "$k (" Execution of D:\progs\perl\junk.pl aborted due to compilation errors.

      Maybe you meant something like:

      print "$_ => $h{$_}\n" for sort keys %h;

      Or the (no doubt) more newbie-friendly:

      for my $k ( sort keys %h ) { print "$k => $h{$k}\n"; };

        ++ seven hours and several upvotes later. It's amazing how few people are trying around here these days.

        -sauoq
        "My two cents aren't worth a dime.";

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-04-18 21:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found