in reply to Extracting numbers from arrays

Add "use strict;" to the top of your script. Next, your snippet seems ill-suited to the task you describe. I would look at doing something like:
use strict; my ($first, $last) = @ARGV; # Pass the values in my @nums = 1 .. 100; my $inside = 0; my @inside_nums; foreach my $num (@nums) { if ($num == $first) { $inside = 1; } if ($inside) { push @inside, $num; } if ($num == $last) { $inside = 0; } } print "@inside\n"; #### for-loop could also be written as: my $inside; foreach my $num (@nums) { $inside = 1 if $num == $first; push @inside_nums, $num if $inside; $inside = 0 if $num == $last; }
Have fun with the rest of your homework.

------
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.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.