printing lines from file separated by |

This commit is contained in:
Dan Buch 2011-01-06 22:44:53 -05:00
parent 0c61e4d061
commit 410b97cde5

View File

@ -18,7 +18,13 @@ if (!defined $ARGV[0]) {
my $infile = $ARGV[0];
open(DAT, $infile) or die "$infile: $!";
print <DAT>;
my @cleaned = ();
foreach my $line (<DAT>) {
$line =~ s/\s*$//;
$cleaned[++$#cleaned] = $line;
}
print join("|", @cleaned) . "\n";
close(DAT);