@duplicate = glob "files/$department/*.txt"; foreach $item (@duplicate) { if ($item eq "files/$department/$number.txt") { $go_sub = 'yes'; } }