Using shift the get value out of an array
@a = (1 .. 10); do { $v = shift @a; print "Current number: $v\n"; } while ($v < 5);