blob: 3cc642db773222c136c7d5c73e7ef152c2e92deb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
#!/usr/bin/env perl
#===============================================================================
#
# FILE: skript3.pl
#
# USAGE: ./skript3.pl
#
# DESCRIPTION:
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Stefan Suhren (su), suhren.stefan@fh-swf.de
# ORGANIZATION: FH Südwestfalen, Iserlohn
# VERSION: 1.0
# CREATED: 06.11.2015 00:27:04
# REVISION: ---
#===============================================================================
use strict;
use warnings;
use utf8;
# enforce utf-8 mode
binmode (STDIN, ":encoding(UTF-8)");
binmode (STDOUT, ":encoding(UTF-8)");
binmode (STDERR, ":encoding(UTF-8)");
use open ":encoding(UTF-8)";
my $ERGEBNIS_file_name = "loesung.dat";
# pipe commands:
my $INPUTPIPE_command = './quadrat|';
my $OUTPUTPIPE_command = " | sort | uniq | column > $ERGEBNIS_file_name";
open my $INPUTPIPE, $INPUTPIPE_command
or die "$0 : failed to open pipe > $INPUTPIPE_command < : $!\n";
open my $OUTPUTPIPE, $OUTPUTPIPE_command
or die "$0 : failed to open pipe > $OUTPUTPIPE_command < : $!\n";
my $german_file_name = 'german.lst'; # input file name
open my $germanFile, '<', $german_file_name
or die "$0 : failed to open input file '$german_file_name' : $!\n";
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";
while (my $line = <$INPUTPIPE>)
{
chomp $line;
if (exists $german{uc $line})
{
printf $OUTPUTPIPE "%s\n", uc $line;
}
}
close $OUTPUTPIPE
or warn "$0 : failed to close pipe > $OUTPUTPIPE_command < : $!\n";
close $INPUTPIPE
or warn "$0 : failed to close pipe > $INPUTPIPE_command < : $!\n";
|