my $Path = 'C:/.../Files'; ## looping through dir $Path and $File has current file name print find(\&findfile, $Path); sub findfile { return 1 if $_ eq $File; }