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
# and a list of project.txt files is given in @ARGV
use File::Spec::Functions qw(rel2abs);
use File::Basename qw(dirname);
# $ARGV contains the name of the project.txt file you're readi
system($otherscript, "--root=".rel2abs($1, dirname($ARGV)), "-
Alternatively you could put this code somewhere inside the $otherscript and call the relevant function instead of the system call.