in reply to using push

  1. USE strict!!!
  2. USE my!!!
  3. Learn how foreach works.
Try something like:
use strict; my @scores. while (my $score = <>) { last if $score =~ /\D/; push @scores, $score; } foreach my $score (@scores) { print "The score was $score\n"; }
That will take a bunch of scores from the command-line (until you hit Ctrl-D or type a non-numeric character), then print them all out for you in the order you entered them.

Note - because I scoped my variables and am using strict, if you try and print $score between the while loop and the foreach loop, you will end up with an error.

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.