in reply to Duplicating array contents

That is one way to take a copy of an array. With that line added to your your program, it is effectively equivalent to:

#!/usr/bin/perl -w use strict; my @a = (1,2,3,4); my @p = @a; print "before:\n"; foreach (@p) { print "element $_\n"; } @a = (); print "after:\n"; foreach (@p) { print "element $_\n"; }

Examine what is said, not who speaks.