in reply to foreach on array

Try it without the '[' and ']'?
push @inpfile, split /\n/;

The '[' and ']' surrounding the split put the result into an "anonymous array", then you push the reference to the anonymous array onto @inpfile. Later when you print one of those values you see 'ARRAY(...)', which it is, an array reference.

Were you perhaps thinking you wanted
push @inpfile, ( split /\n/ );