summaryrefslogtreecommitdiffstats
path: root/Aufgabe3/skript2.pl
diff options
context:
space:
mode:
authorStefan Suhren <suhren.stefan@fh-swf.de>2015-11-06 10:44:17 +0100
committerStefan Suhren <suhren.stefan@fh-swf.de>2015-11-06 10:44:17 +0100
commita28373665a3cfa42d21462b92244697e6f8f0a7d (patch)
treeb5842d97a5cd18d64999320ed12de3c692651d6c /Aufgabe3/skript2.pl
parentcda8651807bff46f458e8e037a2d3bab62dae5e5 (diff)
downloadSkriptsprachen-a28373665a3cfa42d21462b92244697e6f8f0a7d.tar.gz
Skriptsprachen-a28373665a3cfa42d21462b92244697e6f8f0a7d.zip
Remove new line from german array
Diffstat (limited to 'Aufgabe3/skript2.pl')
-rw-r--r--Aufgabe3/skript2.pl9
1 files changed, 7 insertions, 2 deletions
diff --git a/Aufgabe3/skript2.pl b/Aufgabe3/skript2.pl
index da9a20a..3107190 100644
--- a/Aufgabe3/skript2.pl
+++ b/Aufgabe3/skript2.pl
@@ -38,7 +38,8 @@ my %german;
while (my $line = <$germanFile>)
{
- $german{uc $line} = 0;
+ chomp $line;
+ $german{uc $line} = uc $line;
}
close $germanFile
@@ -54,6 +55,7 @@ my @loesung;
while (my $line = <$quadratFile>)
{
+ chomp $line;
if (exists $german{uc $line})
{
push @loesung, uc $line;
@@ -86,7 +88,10 @@ my $loesungFile_file_name = 'loesung.dat'; # output file name
open my $loesungFile, '>', $loesungFile_file_name
or die "$0 : failed to open output file '$loesungFile_file_name' : $!\n";
-print $loesungFile @loesung_unique;
+foreach my $field (@loesung_unique)
+{
+ printf $loesungFile "$field\n";
+}
close $loesungFile
or warn "$0 : failed to close output file '$loesungFile_file_name' : $!\n";