in reply to Recursive Hash and XML::Simple Processing Time

when the file gets to be too long (20,000 lines), this method takes a very long time.

Could be because you're loading the entire file to @file before processing.
Try

open(my $AFILE, '<', $file) || warn "ERROR - Couldn't open $file - $!\ +n"; while (<$AFILE>) { #call the processing as a subroutine } close $AFILE || warn "ERROR - Couldn't close $AFILE - $!\n";
Also to shorten the running time say return; instead of $index++;.
If you don't wish to use a sub, but to run it all in the while loop, call next instead of incrementing the index.

Software speaks in tongues of man; I debug, therefore I code.