Trying to learn programming on your own is a daunting task. I suggest getting a beginning book, perhaps "Perl for Dummies". I think you can get a used copy of this at a reasonable price. There are other books, but a lot of them start off too quickly for someone with no programming experience. I congratulate you on trying to learn a new skill.
Here is some code for you to play with. There are many flaws in this, but I think you just wanted a simple demo of an input loop.
#!/usr/bin/perl
use warnings;
use strict;
my $numbers = "2 1 3 4 5";
my @numbers = split(' ', $numbers);
print "numbers are: @numbers\n";
my $input;
print "Enter numbers 1-5, q to quit:\n";
while ($input =<STDIN>, $input !~/q/i)
{
chomp $input; #needed to get rid of line ending
print "the $input th num: $numbers[$input-1]\n";
}
print "program completed\n";
__END__
numbers are: 2 1 3 4 5
Enter numbers 1-5, q to quit:
3
the 3 th num: 3
5
the 5 th num: 5
q
program completed
Update: saw this
free beginning Perl online book. Price is right! Still goes very quickly for a non-programmer.