You are calling your sub with a an array as "first argument":
&delete_node(@elements,$file_to_read);
But in your sub you expect an arrayref:
my ($elements,$file_to_read) = @_;
You need to pass your data in as a reference. Also, don't call subs with "&". And if your learning material teaches you to, throw it away. delete_node(\@elements,$file_to_read);
See if that fixes it.
holli
You can lead your users to water, but alas, you cannot drown them.