Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Array problems.....

by vinoth.ree (Monsignor)
on Mar 19, 2013 at 04:58 UTC ( #1024205=note: print w/replies, xml ) Need Help??


in reply to Array problems.....

Try this too...

use strict; use warnings; use Data::Dumper; my %hash; while(<DATA>) { my ($player,$tableid) = split; if (exists $hash{$tableid}) { push ($hash{$tableid},$player); } else { $hash{$tableid} = [$player]; } } print Dumper \%hash; while(my($tableid,$player) = each(%hash)) { print "\n\nTableid:$tableid\n"; print "\nPlayer:".join("\n",@{$player}); print "\nTotal:". scalar @{$player}; } __DATA__ kapp2cape1111 224 kapp2cape1113 224 kapp2cape1112 224 kapp2cape1111 225 kapp2cape1113 225 kapp2cape1112 225

All is well

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1024205]
help
Chatterbox?
[msh210]: I think I just found a lie in perldoc.
[msh210]: warn: "If the last element of LIST does not end in a newline, it appends the same file/line number text as die does."
[msh210]: perl -e'warn "test$/", "" '
[msh210]: doesn't append anything.
[msh210]: It should say "If the last nonempty element of LIST" or "If the string thus to be printed does not end in a newline""
[msh210]: Am I wrong?
[shmem]: no. You're right.

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2017-04-24 12:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (439 votes). Check out past polls.