#! /usr/bin/perl -w use strict; use Symbol; main: { my @buf = (); my $running = 0; my $file = $ARGV[0] || die "usage: $0 filename\n"; my $inch = Symbol::gensym; open($inch, '<', $file) || die "Could not open input file '$file'\n"; while (my $line = <$inch>) { chomp $line; push @buf, $line; my @stuff = split(' ', $line); $running += $stuff[0]; } close $inch; my $total = $running; $running = 0; open($inch, '<', $file) || die "Could not reopen input file '$file'\n"; while (my $line = <$inch>) { chomp $line; push @buf, $line; my @stuff = split(' ', $line); $running += $stuff[0]; my $frac = 100 * $running / $total; if (0) { printf("%5d %5d %5.1f %s\n", $stuff[0], $running, $frac, $stuff[1]); } else { print 'blacklist_from *@', $stuff[1], "\n"; } } }