in reply to Re: Regexp and object's methods.
in thread Regexp and object's methods.

As far as I read perlre, (?{}) is the only way to get code directly into a regexp.

so your wanted code must look like:

if ($status == C->CONST1) { print "1" } elsif ($status =~ /(?{ C->CONST2 })|(?{ C->CONST3 })/) { print "2 or 3" ; } else { print 'Something'; }

I don't see, why you don't want to use some of the more readable solutions suggested by the other monks, espacially a sub that assembles the regexp for you seems a good way to me, though...
maybe that I really don't understand what you want to do...

regards,
tomte


Hlade's Law:

If you have a difficult task, give it to a lazy person --
they will find an easier way to do it.