http://qs1969.pair.com?node_id=1185398


in reply to How to read the input directory from command line arguments using perl?

I'll assume you can have more than one project.txt file in different locations, and that the directory is relative to the directory that project.txt file is in. $otherscript contains the script that starts with the code you gave.

Then you can do something like:

# Assuming you already have read/set the values for $output_dir and $m +ap_file... # and a list of project.txt files is given in @ARGV use File::Spec::Functions qw(rel2abs); use File::Basename qw(dirname); while(<>) { if(/^REVISION_LOCATION:(.*)/) { # $ARGV contains the name of the project.txt file you're readi +ng system($otherscript, "--root=".rel2abs($1, dirname($ARGV)), "- +-outdir=$out_dir", "--map=$map_file"); } }

Alternatively you could put this code somewhere inside the $otherscript and call the relevant function instead of the system call.