Add simple scripts used in interviews
This commit is contained in:
parent
2c82137a71
commit
d1a39bf85d
2 changed files with 65 additions and 0 deletions
20
interview_scripts/fizzbuzz.pl
Executable file
20
interview_scripts/fizzbuzz.pl
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
#Fizz buzz example
|
||||
# For 1 .. 10 if odd print fizz, otherwise print buzz
|
||||
|
||||
for my $num (1..10) {
|
||||
# print "$num: "; # Debug
|
||||
if ($num % 2) {
|
||||
print "fizz\n";
|
||||
}
|
||||
else {
|
||||
print "buzz\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue