chdir 'D:\COLD\DULS' or die "Can't chdir: $!"; my @files = glob ('cold*'); if (scalar @files) { foreach my $file (@files) { print CBDOWNLOAD "Cold Backup file exists for DULS for $FileName.\n" ... } } else { system ('awtrap -h RLGH -f DULS "DULSVASG001: Unable to download the file."'); }