#!/usr/bin/perl open(DAT, $ARGV[0]) || die("Could not open file ".$ARGV[0]); while ($file = ) { $file =~ s/\s+$//; unlink($file); }