my @arr = qw( one two three ); sub while_with_shift_push { my $ref; my @cp = @arr; push( @$ref, $_ ) while( $_ = shift( @cp ) ); return $ref; } sub for_with_push { my $ref; my @cp = @arr; push( @$ref, shift( @cp ) ) for ( 0..$#cp ); return $ref; } sub splice_it { my $ref; my @cp = @arr; push( @$ref, splice( @cp ) ); return $ref; } sub push_with_clear { my @cp = @arr; my $ref; push( @$ref, @cp ); @cp = (); return $ref; }