Simple perl help

This is for a windows based machine.

I need it to find the newest created file in a folder than set it as a variable so i can use it in my script.

I tried this:use File:irList; my @list = File:irList::list(‘.’, ‘M’);

from this:

print "hello worldn";

$variable = 1;
$dirName = "/";
$sortMode = "m";
$noLinks = "false";
$hideDotFiles = "false";
$showSelf = "true";
print "The variable has the value of $variablen";
use File:irList; my @list = File:irList::list(‘.’, ‘M’);
list($dirName, $sortMode, $noLinks, $hideDotFiles, $showSelf);

print $list[1];

?

is giving me this:

C:lol>perl test.pl
hello world
The variable has the value of 1
Undefined subroutine &main::list called at test.pl line 10.

I tried this but i dont think its showing the newest one.

$dirname = ".";
opendir(DIR, $dirname) or die $!;
@files = sort { -m "$dirname/$a" <=> -M "$dirname/$b"}
grep {-f "$dirname/$_"}
readdir(DIR);
print $files[0];

I also reversed the a and b and it still shows the same file name? Possibly this script isnt taking account of time?