diff options
| author | Martin Talarczyk <martin@talarczyk.de> | 2015-11-13 12:17:15 +0100 |
|---|---|---|
| committer | Martin Talarczyk <martin@talarczyk.de> | 2015-11-13 12:17:15 +0100 |
| commit | f08f2d0e3798ff90b7e68c46751e15b7b991a2a0 (patch) | |
| tree | 46d12d0da15882ec53d2a016e3252b05638d6b98 /Aufgabe2/StatistischeUntersuchung.pl | |
| download | Skriptsprachen-f08f2d0e3798ff90b7e68c46751e15b7b991a2a0.tar.gz Skriptsprachen-f08f2d0e3798ff90b7e68c46751e15b7b991a2a0.zip | |
Commitel Aufgabe 1 bis 4
Diffstat (limited to 'Aufgabe2/StatistischeUntersuchung.pl')
| -rw-r--r-- | Aufgabe2/StatistischeUntersuchung.pl | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/Aufgabe2/StatistischeUntersuchung.pl b/Aufgabe2/StatistischeUntersuchung.pl new file mode 100644 index 0000000..b53af4d --- /dev/null +++ b/Aufgabe2/StatistischeUntersuchung.pl @@ -0,0 +1,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; + + |
