c:\@Work\Perl\monks>perl -e
"use warnings;
use strict;
;;
my @ListPeople = ListOfNames();
;;
PERSON:
for my $counter (0 .. $#ListPeople) {
my $ar_person = $ListPeople[$counter];
last PERSON if $ar_person->[0] eq '';
print qq{$counter. What is my Name: @$ar_person \n\n};
};
;;
sub ListOfNames {
my @LON;
;;
$LON[0][0] = 'Tim';
$LON[0][1] = 'O';
$LON[0][2] = 'Tay';
;;
$LON[1] = [ 'John', 'Fitz', 'Gerald' ];
;;
$LON[2] = [ qw(Gerald Fitz John) ];
;;
push @LON, [ '', 'not', 'here' ], [ 'Billy', 'Bob', 'Thornton' ];
;;
return @LON;
}
"
0. What is my Name: Tim O Tay
1. What is my Name: John Fitz Gerald
2. What is my Name: Gerald Fitz John
The ListOfNames() function could simply be written as:
sub ListOfNames {
return
[ 'Tim', 'O', 'Tay' ],
[ 'John', 'Fitz', 'Gerald' ],
[ qw(Gerald Fitz John) ],
[ '', 'not', 'present' ],
[ 'Billy', 'Bob', 'Thornton' ],
;
}
Give a man a fish: <%-{-{-{-<
|