blob: 971f6dd5b5006fdaf2afa9edeb8cdecbe8b0fb59 (
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
|
#!/usr/bin/env perl
#===============================================================================
#
# FILE: skript1.pl
#
# USAGE: ./skript1.pl
#
# DESCRIPTION:
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Stefan Suhren (su), suhren.stefan@fh-swf.de
# ORGANIZATION: FH Südwestfalen, Iserlohn
# VERSION: 1.0
# CREATED: 09.10.2015 10:06:46
# REVISION: ---
#===============================================================================
use strict;
use warnings;
use utf8;
# enforce utf-8 mode
binmode (STDOUT, ":encoding(UTF-8)");
binmode (STDIN, ":encoding(UTF-8)");
use open ":encoding(UTF-8)";
my $poem_file_name = 'Rilke-Herbsttag.txt'; # input file name
open my $poem, '<', $poem_file_name
or die "$0 : failed to open input file '$poem_file_name' : $!\n";
my @poemRead;
my $lines = 0;
while (my $line = <$poem>)
{
push(@poemRead, $line);
print $line;
++$lines;
}
close $poem
or warn "$0 : failed to close input file '$poem_file_name' : $!\n";
printf "Read lines: $lines\n";
print reverse @poemRead;
print sort @poemRead;
|