in reply to Re: Counting devices types, device sizes and number of devices.
in thread Counting devices types, device sizes and number of devices.

Hi JavaFan,

That's neat. Now I just need to figure out a way to get those values inside the hash.

Perlpetually Indebted To PerlMonks

  • Comment on Re^2: Counting devices types, device sizes and number of devices.

Replies are listed 'Best First'.
Re^3: Counting devices types, device sizes and number of devices.
by jaimon (Sexton) on Jan 03, 2012 at 08:36 UTC

    use Data::Dumper; while (<DATA>) { chomp; @F = split /\t/; # <== place proper delimiter or regex $devices{$F[4]}{$F[-1]}++; } $Data::Dumper::Sortkeys = 1; print Dumper \%devices; # accessing for $type (sort keys %devices) { for $size (sort {$a <=> $b} keys %{$devices{$type}}) { print "$type $size $devices{$type}{$size} \n"; } }
    - J

      Hi Jaimon,

      Thanks a lot. But thing is, the output given in my post is output of a command.Does Data Dumper have the facility to take in command output?

      Perlpetually Indebted To PerlMonks