in reply to Substitution query
Yeah, it can be done on the next line after your tr:
$fn =~ s/gpfs_data/nas\/rdds/;
You definitely don't want to loop through the entire @allpathlisting array every time you add a single new file to it.
In Section
Seekers of Perl Wisdom