in reply to Moving Input Data Files into Script Proper.

You can set @ARGV to whatever you like:
@ARGV = glob("/home/dir/myinput/*"); while (<>) { # do stuff with $_ }

ar0n ]

Replies are listed 'Best First'.
Re: (ar0n) Re: Moving Input Data Files into Script Proper.
by clintp (Curate) on Jun 17, 2001 at 20:02 UTC
    And if you push:
    push(@ARGV, glob("/home/dir/myinput/*"));
    You get the added bonus of being able to run the script with -d (and other switches) for debugging without having to recode that bit. The filenames just get added onto the end.

      If you are talking Perl's debugger, then changing @ARGV won't have any effect on the -d switch that enables this. @ARGV is the arguments passed to the Perl script and doesn't include (nor modify) the switches and arguments passed to the perl executable (such as -w, -d, or which script to run).

              - tye (but my friends call me "Tye")
        The point was that pushing (as opposed to assigning) into @ARGV doesn't interfere with any argument processing -- yours (Getopt) or Perl's (-laneipdw0...). Whatever you push will just get processed at the end of whatever you typed which is what he wanted...