in reply to Re: perl sort issue while going through article at perl.com
in thread perl sort issue while going through article at perl.com
I was tryingmy %histogram; $histogram{$_}++ for @list;
but above actually prints out the reference address. I tried few different things but does not print out the actual value.. can someone give me a pointer on this(no pun intended).. thanks. for example like below....foreach (@data1) { $hist{$_}++ for $_; } my @uni = keys %hist; print "@uni\n";
#!/usr/bin/perl -w use strict; use warnings; use Data::Dumper; my $ref = { a => { A => 1, B => 2, C => 3}, b => { D => 1, E => 2, F => 4}, c => { G => 2, H => 1, I => 2}, }; #print Dumper($ref); my %hist; foreach ($ref) { $hist{$_}++ for $_; } my @uni = keys %hist; print "@uni\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: perl sort issue while going through article at perl.com
by shmem (Chancellor) on Oct 22, 2007 at 08:16 UTC | |
by convenientstore (Pilgrim) on Oct 22, 2007 at 14:55 UTC | |
by convenientstore (Pilgrim) on Oct 23, 2007 at 00:30 UTC | |
by shmem (Chancellor) on Oct 23, 2007 at 05:51 UTC | |
by convenientstore (Pilgrim) on Oct 23, 2007 at 22:14 UTC | |
by FunkyMonk (Bishop) on Oct 23, 2007 at 22:57 UTC | |
by convenientstore (Pilgrim) on Oct 24, 2007 at 00:46 UTC |