#!/usr/bin/perl -p BEGIN { $file = '-' } chomp; die "trailing space at line $.\n" if /[ \t]$/; $len = length($_); $_ = "$file $. $_ $len\n";