my $exclude = 'asdf'; # Maybe user input or other program logic my @downloads = grep { $_ ne $exclude } @file_list;