You are confusing the things a little bit.
When you do @x = @{$a} you are "copying" the
content of "@{$a}" to "@x". With foreach, you are
just passing a reference to it...
If you don' wanna mess with your original array, you
need to copy it to a second array (like you did @x=@{$a})
and use @x ...
@x = @{$a};
foreach my $i (@x) {
print"$i\n";
undef $i;
}
or as someone suggested before:
my $a = ['a', 'b', 'c'];
foreach (@{$a}) {
my $i = $_;
print"$i\n";
undef $i;
}