in reply to Re: regex in perl
in thread regex in perl
my @temp = grep {$RE{net}{IPv6}{-sep=>':'}{-style=>'HeX'}} @$records;
I haven't tested it, but I think the $RE{net}{IPv6}{-sep=>':'}{-style=>'HeX'} expression is just a Regexp object and needs, in this case, to be interpolated into an m// operator:
my @temp = grep { m/$RE{net}{IPv6}{-sep=>':'}{-style=>'HeX'}/ } @$records;
Or slightly more simply:
my @temp = grep m/$RE{net}{IPv6}{-sep=>':'}{-style=>'HeX'}/, @$records;
In the second case, note the m// is delimited by a ,(comma).
Update: Or you could explicitly bind to the "topicalization" scalar $_ with the ~= operator (again, untested):
my @temp = grep { $_ =~ $RE{net}{IPv6}{-sep=>':'}{-style=>'HeX'} } @$records;
or:
my @temp = grep $_ =~ $RE{net}{IPv6}{-sep=>':'}{-style=>'HeX'}, @$records;
Give a man a fish: <%-{-{-{-<
|
|---|