in reply to understanding regex
Hello rookie696, and welcome to the Monastery!
In a regex, [^(asdf)] is a character class which says: match one character as long as that character is not a parenthesis or a lower-case ‘a’, ‘s’, ‘d’, or ‘f’. This is not what you want.
^(?!asdf) says: match the beginning of the line not followed by ‘asdf’. This will work, but it uses a negative look-ahead assertion which is overkill for your purpose.
What you want is simply to negate a normal match. For example:
my @files = ...; for my $file (@files) { download($file) unless $file =~ /^asdf/; }
Or, equivalently,
for my $file (@files) { download($file) if $file !~ /^asdf/; }
You should read up on regexes. Here are some good references:
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|