Yep, switch the variables in your match test.
But if your data are really like that then you should have them in a hash and check them there rather than stringifying and testing with a regexp.
#!/usr/bin/env perl use strict; use warnings; my %hash; for(qw/1689 9679 6978 2792 2514 5472 1520 9342 5544 1268 0165 1979 731 +4 2101 7221 +9539 3882 1812/) { $hash{$_}++; } my $tested = '2101'; if( exists $hash{$tested} ) { print "OK"; } else { print "Not there"; }
In reply to Re: Regex with variables
by 1nickt
in thread Regex with variables
by cormanaz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |