-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathperl.pl
More file actions
52 lines (38 loc) · 1.01 KB
/
perl.pl
File metadata and controls
52 lines (38 loc) · 1.01 KB
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
my @dictionary = ("Chocolat","Science","Informatique","Musique","Geologie","Gastronomie");
my $victory = 0;
my $userSelect
sub getOneWord(tableau) {
my $randNbr = rand(length(tableau))
my $myWord = tableau[$randNbr]
my @myWordSplit.split("", $myWord)
for( my $i = 0; $i < length(@myWordSplit) ; $i++) {
@myWordSplit[$i] = @myWordSplit[$i].uc()
}
return @myWordSplit
}
sub buildUserArray(wordArray) {
my @ArrayUser = []
for(my $i = 0; i < length(wordArray); $i++) {
push @ArrayUser, 'X'
}
print "@ArrayUser"
}
#Tableau et Tableau associatif
my @tab1 = ("hello", 3, $a); #tableau simple
my %tab2 = (
"insert1" => "hello"
"insert2" => 3
)
my @tabMap = (2,3,4,5,6)
my @tabMapSort = map( { $_* = 2} @tabMap) #multiplie tous les elements de @tapMap par deux
#les conditions if, while,
if ($a == 1) {
print "Je suis egal"
} else {
print "Je ne suis pas égal"
}
print "Comparaison ok" if(defined($a))
while ($a =< 10) {
print "Encore un !"
$a++
}