in reply to Regex for zip files.
Not sure what you're really doing but the /zip$/ works-
use warnings; # Don't leave out! use strict; # This neither! my @files = qw( zip.meta some.zip ); for my $file ( @files ) { print $file, "\n"; print $file =~ /zip$/ ? "\tZip!\n" : "\tNada y pues nada...\n"; }
I don't know exactly what you're doing but you always keep in mind that trusting user data or even file extensions is a mistake. Test/validate. Just because it ends in .zip doesn't mean it's a zip file. So you might want to ask about your final goal instead of your code difficulty with the matches.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex for zip files.
by Karger78 (Beadle) on Jun 09, 2009 at 20:45 UTC | |
by Your Mother (Archbishop) on Jun 09, 2009 at 20:52 UTC | |
by Karger78 (Beadle) on Jun 09, 2009 at 20:58 UTC |