From fda71812015962aff98388cdc2ad59ea1104aa70 Mon Sep 17 00:00:00 2001 From: Stefan Suhren Date: Fri, 6 Nov 2015 10:45:11 +0100 Subject: Remove new line from german and pipe directly --- Aufgabe3/skript3.pl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Aufgabe3/skript3.pl b/Aufgabe3/skript3.pl index 68ed536..3cc642d 100644 --- a/Aufgabe3/skript3.pl +++ b/Aufgabe3/skript3.pl @@ -49,24 +49,22 @@ my %german; while (my $line = <$germanFile>) { + chomp $line; $german{uc $line} = 0; } close $germanFile or warn "$0 : failed to close input file '$german_file_name' : $!\n"; -my @loesung; - while (my $line = <$INPUTPIPE>) { + chomp $line; if (exists $german{uc $line}) { - push @loesung, uc $line; + printf $OUTPUTPIPE "%s\n", uc $line; } } -print $OUTPUTPIPE @loesung; - close $OUTPUTPIPE or warn "$0 : failed to close pipe > $OUTPUTPIPE_command < : $!\n"; close $INPUTPIPE -- cgit v1.2.3-70-g09d2