in reply to how can I input different files as an argument while I am running my perl program?

When you run your program, just specify the filename as an argument on the command line:
./ file1.txt <optionally more files>
The filenames can then be found inside the script in the global array @ARGV.