summaryrefslogtreecommitdiffstats
path: root/Aufgabe4/skript2.pl
blob: bba74da38a15ec8fb19736d040d4200d8ecdeb31 (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
#!/usr/bin/env perl 
#===============================================================================
#
#         FILE: skript2.pl
#
#        USAGE: ./skript2.pl  
#
#  DESCRIPTION: 
#
#      OPTIONS: ---
# REQUIREMENTS: ---
#         BUGS: ---
#        NOTES: ---
#       AUTHOR: Stefan Suhren (su), suhren.stefan@fh-swf.de
# ORGANIZATION: FH Südwestfalen, Iserlohn
#      VERSION: 1.0
#      CREATED: 19.11.2015 15:51:03
#     REVISION: ---
#===============================================================================

use strict;
use warnings;
use utf8;

use wordGame;

# 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	$german9_file_name = 'GERMAN9.LST';		# input file name

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

my @wort = <$german9>;

close  $german9
	or warn "$0 : failed to close input file '$german9_file_name' : $!\n";

my $schwierigkeitsgrad = 2;
my $index = int rand (int @wort);
my @raetsel = verwuerfeln( $wort[$index], $schwierigkeitsgrad);

# remove new lines
chomp @raetsel;

for (my $i = 0; $i < 9; $i++)
{
	if( $i % 3 == 0)
	{
		print "\n";
	}
	print $raetsel[$i] . " ";
}

print "\n\n";

my $eingabe = <>;

print $wort[$index];