use strict;
use warnings;

my $inFile = $ARGV[0];
open(my $fhIn, "<", $inFile) 
    or die "Could not open $inFile $!";

my $outFile = $ARGV[1];
open(my $fhOut, ">", $outFile)
    or die "Could not create $outFile $!";

my $outDir = $ARGV[2];

while (my $line = <$fhIn>)
{
    chomp($line);
    my @fields = split('/', $line);
    my $fileName = $fields[@fields - 1];
    print $fhOut "$line $outDir/$fileName\n";
}

close $fhIn;
close $fhOut;
