Stephen Reese wrote:
printf() (as seen three lines down) has a format string and a list of values corresponding to the % escapes in that string. Because you are using a string literal you should use print() instead.foreach my $i (sort { $quad{$b} <=> $quad{$a} } keys %quad) { if ($n++ >= $ntop) { last }; printf ("%6s:%s\n", $quad{$i},$i); } $n=0; printf "\nDestination Port Summary:\n"; foreach my $i ( sort { $port{$b} <=> $port{$a} } keys %port) { if ($n++ >= $ntop) { last }; printf ("%6s: %s\n", $port{$i},$i); } $n=0; printf "\nSource Address Summary:\n"; foreach my $i ( sort { $srca{$b} <=> $srca{$a} } keys %srca) { if ($n++ >= $ntop) { last }; printf ("%6s: %s\n", $srca{$i},$i); }John, when I change those statements to print() from printf() I get a '%6s:%s' that prefix each line. And the count is then formatted incorrectly.
You trimmed away the code I was commenting on:
printf "Connection Summary:\n";
Where the string literal "Connection Summary:\n" does not have any formatting escapes like %s or %d and therefore you should be using print() instead of printf().
John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
