> Hello Sayth
>
> The program you have published seems to work fine. Are you certain that
> the print line inside the foreach loop is as you say?
>
> Rob
>
This is copied direct from my editor.
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
my @mynames = qw/fred betty barney dino wilma pebbles bamm-bamm/;
print " Enter a number from 1 to 7: ";
chomp(my @nums = <STDIN>);
foreach (@nums) {
print "$mynames[ $_ - 1 ]\n";
}
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/