summaryrefslogtreecommitdiffstats
path: root/Aufgabe2/StatistischeUntersuchung.pl
blob: b53af4d96ebf020e66f30f6e7d3058ec2fd12570 (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
#!/usr/bin/env perl 
#===============================================================================
#
#         FILE: StatistischeUntersuchung.pl
#
#        USAGE: ./StatistischeUntersuchung.pl  
#
#  DESCRIPTION:	Gibt eingelesendes aus und zählt die Zeilen.
#
#      OPTIONS: ---
# REQUIREMENTS: ---
#         BUGS: ---
#        NOTES: ---
#       AUTHOR:	Martin Talarczyk 
# ORGANIZATION: FH Südwestfalen, Iserlohn
#      VERSION: 1.0
#      CREATED: 15.10.2015 10:28:41
#     REVISION: ---
#===============================================================================



use strict;
use warnings;
use utf8;

binmode (STDIN, ":encoding(UTF-8)");
binmode (STDOUT, ":encoding(UTF-8)");
binmode (STDERR, ":encoding(UTF-8)");
use open ":encoding(UTF-8)";


#-------------------------------------------------------------------------------
#  Variabelen Deklarasion
#-------------------------------------------------------------------------------
# Feld das In jedem Elemen eine Zeile enthält

my @arryLine; # Feld mit Zeilen.

my $countLine = 0; # anzahl der Zeichen. 

#open file
my	$opfp_file_name = 'Rilke-Herbsttag.txt';		# input file name

open  my $opfp, '<', $opfp_file_name
	or die  "$0 : failed to open  input file '$opfp_file_name' : $!\n";

while(my $line =  <$opfp>)
{
	push(@arryLine,$line);	
	
	print $line;

	$countLine++;

}

#close file
close  $opfp
	or warn "$0 : failed to close input file '$opfp_file_name' : $!\n";

print "Das Dokument hat " . $countLine. " Zeilen.\n\n";
print "zum vergleich " . `wc -l Rilke-Herbsttag.txt`;

print sort @arryLine;

print reverse @arryLine;