in reply to Re: Array element getting deleted
in thread Array element getting deleted

Indeed $_ is being modified. Instead of this:
foreach(@files) {
    print "The file is $_\n";
    func();
}
use:
foreach my $q (@files) {
    print "The file is $q\n";
    func();
}
That way the variable is assigned to $q instead of $_ and you can do with it whatever you like.