diff --git a/cli/exercise_02/input_fromfile.pl b/cli/exercise_02/input_fromfile.pl index ebbe854..ee227fc 100644 --- a/cli/exercise_02/input_fromfile.pl +++ b/cli/exercise_02/input_fromfile.pl @@ -18,7 +18,13 @@ if (!defined $ARGV[0]) { my $infile = $ARGV[0]; open(DAT, $infile) or die "$infile: $!"; -print ; +my @cleaned = (); +foreach my $line () { + $line =~ s/\s*$//; + $cleaned[++$#cleaned] = $line; +} + +print join("|", @cleaned) . "\n"; close(DAT);