#!/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;