in reply to Re^2: How to look for two different file extensions?
in thread How to look for two different file extensions?
if ($FileExt eq '.xlsx' || '.pdf'){
Unfortunately that doesn't work, although TIMTOWTDI (There's More Than One Way To Do It):
if ( $FileExt eq '.xlsx' || $FileExt eq '.pdf' ) { print "Match!\n" } if ( $FileExt =~ /^\.(?:xlsx|pdf)$/ ) { print "Match!\n" } use Quantum::Superpositions; # OR #use Perl6::Junction qw/ all any none one /; if ( $FileExt eq any('.xlsx','.pdf') ) { print "Match!\n" }
Perl 6 supports Junctions natively, but note that Perl 6 is a related but different language that I wouldn't call production ready yet.
Update: Added a word.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |