in reply to adding a variable definition to execution
As a quick-start, you could wrap the interactive part like so:
Now, you can provide the filename as first argument or fall back into interactive mode. See e.g. Getopt::Long for another approach. Be careful with $var = shift; since it behaves different when called from inside or outside of a subroutine.... if (@ARGV) { # test if there is at least one argument $basename = $ARGV[0]; # set basename to first argument } else { # otherwise be interactive print "Enter base name of input files\n"; chomp ($basename = <STDIN>); } ...
|
|---|