-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsource.pl
41 lines (41 loc) · 936 Bytes
/
source.pl
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
#!/usr/bin/env perl
use strict;
use warnings;
open(my $in, "<", "animals.back") or die "Can't open config file";
#do some work
print "Enter your name";
my $userName = <STDIN>;
chomp $userName;
for(my $i=9; $i != 0; $i-=1){
print "$i\n";
if($i == 4){
print "Almost";
}
}
my $other = <$in>;
my $longString = "Hello $userName! How your $other";
my @animals = ("camel", "llama", "owl");
my $x = @animals;
my $y = getHugeNumber();
my $value = shift @animals;
unshift @animals, $other;
if (($x < 11) || ($y > 11)){
if($y < 11 && $z > 43){
print"Let's me do some magic";
}
}
sub getHugeNumber{
my @array = ();
my $arrayLength = 10;
for(my $i = 1; $i <= $arrayLength; $i += 1){
push @array, int(rand(42));
}
return $array[int($arrayLength)];
}
sub getOtherNumber{
my $number = getHugeNumber();
if($number < 777){
$number = 42;
}
return $number;
}