# Assuming you already have read/set the values for $output_dir and $map_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 reading system($otherscript, "--root=".rel2abs($1, dirname($ARGV)), "--outdir=$out_dir", "--map=$map_file"); } }