$report = (sort glob "$path/*B1006*")[-1]; #### $report = (sort { -M $a <=> -M $b } glob "$path/*B1006*")[-1]