I’m writing a Perl script, and I’d like a way to have the user enter a file or a file containing a list of files in $ARGV[0].
The current way that I’m doing it is to check if the filename starts with an @, if it does, then I treat that file as a list of filenames.
This is definitely not the ideal way to do it, because I’ve noticed that @ is a special character in bash (What does it do by the way? I’ve only seen it used in $@ in bash).
You can specify additional parameter on your command line to treat it differenly e.g.
for reading file‘s content, or
for reading list of files from file.
You can use getopt module for easier parsing of input arguments.