Thank you. That clears a lot up. Currently the script using @ARGV = glob('*.SAM'); will only run to completion if the .txt files are specified on the command line along with it rather than simply running it within a directory containing .txt files. I'm not sure why this is occurring. When I do specify .txt files, I get the error: sh: -c: line 1: syntax error: unexpected end of file.