Change my $fileAge = -M $fileName; to my $fileAge = (stat($filename))[9];
Update: Looks like it is probably the path being wrong. Apparently these commands do pretty much the same thing internally(which is probably good to know), so just ignore my original answer.