> Hi,
> 
> my ($str) = "HI, HELLO, GREETINGS";
> my ($reg) = "(BYE|HI|CIAO)";
> 
> if ($str =~ /$reg/)
>       { print "Exists in $str\n"; }
> 
> The above code, will return true if BYE, HI or CIAO exists
> in $str.
> I want a regex to be put in $reg, which will return true
> if neither BYE, HI nor CIAO exists in $str
> 
> I could've done something like:
> if ($str !~ /$reg/)
>       { ... }

Seems like if($str !~ /$reg/) {} would do what you want.
What exactly are you trying to do?

> 
> but, I don't want to change the code, just $reg.

Not sure that's possible and I can't really see what benefit you'd get anyway.

> 
> I've been trying to find something in Programming Perl,
> but couldn't.
> 
> Does anyone know how you can do this??
> 
> Thanks.
> 
> George P.
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to