in reply to Re^2: TIMTOWTDI - printing an array
in thread TIMTOWTDI - printing an array

print shift @array while @array;

... which prints, but also dismantles an array.

Using that idiom inside an anonymous subroutine is non-destructive!

knoppix@Microknoppix:~$ perl -E ' > @arr = qw{ 11 22 33 44 }; > sub { say shift while @_ }->( @arr ); > say qq{@arr};' 11 22 33 44 11 22 33 44 knoppix@Microknoppix:~$

Cheers,

JohnGG