Hakim Singhji wrote:
Hi All,

Hello,

This is my first post at beginners. I am working with Learning Perl
(Llama!) and I like to tweak some of the problems and create more
creative solutions to some things. I cannot figure out why this is not
working. Can anyone point out an error in my code.

> #! Perl
>
> @names = qw( fred barney betty wilma dino );
> print "Enter some numbers 1 to 5, one per line, then press ctrl Z:\n";
> chomp (@numbers = <STDIN>);
> ~  if (@numbers > 5) {
  ^
  ^
>       print "Error: choose numbers less then 6!\n";
> ~  } else {
  ^
  ^
>       foreach (@numbers); {
                          ^
                          ^
>           print "$names[ $_ - 1 ]\n";
>       }

Remove the characters indicated by ^ and it should work.


John
--
use Perl;
program
fulfillment

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to