>
> Use a block sort to sort numerically:
>
> perl -E '%h=qw(3 a 2 b 1 c 4 d); say sort { $a<=>$b } keys %h;'
>
> Show us what you have so far if you need help with a specific code segment.
>

references are still a bit foreighn to me. Below is the error I am
getting along with the snippit of code.

Can't use string ("ND") as a HASH ref while "strict refs" in use at
./datalink.pl line 48, <$SUM> line 4060.

my $href = \%data;

sub ND_or_multiple {
  my %uniq;
  for (values %{$href->{$_[0]}}) {
     return 1 if $_ eq 'ND';
     $uniq{$_}++;
     return 1 if keys %uniq > 1;
  }
  return '';
}

my @wanted = grep ND_or_multiple($_), sort  keys %$href;

foreach my $cell ( @wanted ) {
  print "$cell:";

  foreach my $hr ( sort keys %{ $href->{$cell}} ) {
    # print "\t$hr";
    foreach my $count ( sort keys %{ $href->{$cell}->{$hr}} ) { # <-- line 48
    print "\t$count";
    }
  }
  print "\n";
}

Thank you,

Chris

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to