in reply to understanding regex
To add to the excellent advice by Athanasius, now would also be a good time to learn about grep:
my @downloads = grep { !/^asdf$/ } @file_list; print "Downloading: @downloads\n";
It's also worth noting that if you truly want to exclude a literal string, you don't need a regex at all, so you could also do:
my @downloads = grep { $_ ne 'asdf' } @file_list;This works just as well if asdf is in a variable.
my $exclude = 'asdf'; # Maybe user input or other program logic my @downloads = grep { $_ ne $exclude } @file_list;
|
|---|