my $offset = tell STDIN; while ( my $line = ) { print "[$offset] $line"; } continue { $offset = tell STDIN; }