print "Please enter the output filename:\n"; my $filename = ; $filename =~ s/\s*$//; # remove newline and other whitespace at the end