Perl multiple qr assigned to variable

Experts,
I'm having problems with the code below.
I'm trying to test

$var2

for two different regexs.
I thought it could be done per below, but I'm getting the following error when running.

$ ./test.pl b fed50c0100****
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(?^:^{1==y=_k=o}{ <-- HERE =v}n]{5}}-)/ at ./test.pl line 15.
Error: does not match
#!/usr/bin/perl

use warnings;
use strict;

my $var1 = $ARGV[0];
my $var2 = $ARGV[1];


my $rx_var1 = qr/[^AaBbCc]{1}/;
my $rx_var2 = (qr/^311480[*0-9a-fA-F]{11}$/|qr/^[0-9A-Fa-f]{10}[*]{4}$/);


if ( $var2 ) {
        if (
                $var1 =~ /$rx_var1/ ||
                $var2 !~ /$rx_var2/

           ) {
                print "Error: does not match"
             }
        else {
                print "All match"
             }


}

Does anyone have any ideas what I'm doing wrong here?

Thanks!

Hi,

Change the line as follows:

my $rx_var2 = (qr/^311480[*0-9a-fA-F]{11}$|^[0-9A-Fa-f]{10}
[*]{4}$/);

instead of

my $rx_var2 = (qr/^311480[*0-9a-fA-F]{11}$/|qr/^[0-9A-Fa-f]{10}
[*]{4}$/);
1 Like

Awesome!

Thanks much.