Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
18
Task/Menu/Perl/menu.pl
Normal file
18
Task/Menu/Perl/menu.pl
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
sub menu
|
||||
{
|
||||
my ($prompt,@array) = @_;
|
||||
return '' unless @array;
|
||||
|
||||
print " $_: $array[$_]\n" for(0..$#array);
|
||||
print $prompt;
|
||||
$n = <>;
|
||||
return $array[$n] if $n =~ /^\d+$/ and defined $array[$n];
|
||||
return &menu($prompt,@array);
|
||||
}
|
||||
|
||||
@a = ('fee fie', 'huff and puff', 'mirror mirror', 'tick tock');
|
||||
$prompt = 'Which is from the three pigs: ';
|
||||
|
||||
$a = &menu($prompt,@a);
|
||||
|
||||
print "You chose: $a\n";
|
||||
Loading…
Add table
Add a link
Reference in a new issue