#!/usr/bin/perl -w my $psnrfile = $ARGV[0]; my @Row = (); my $lines = 0; my $quants_total = 0; my %quants = (); open PSNR, "< $psnrfile" or die "Can\'t open PSNR file $psnrfile\n"; while() { $lines++; @Row = split; $Row[1] =~ s/\,$//; $Row[1] =~ s/\,/./; $Row[1] = sprintf("%.0f", $Row[1]); $quants{$Row[1]}++; $quants_total += $Row[1]; } close PSNR; for $quant (sort( { $a <=> $b } keys %quants)) { printf("$quant:\t% 8d\t% 8.2f%%\t% 8.2f%%\n",$quants{$quant},$quants{$quant}/$lines*100,$quants{$quant}*$quant/$quants_total*100); }