Chad Perrin wrote: > On Fri, Dec 29, 2006 at 11:36:25PM -0500, Mathew Snyder wrote: >> I'm trying to set up an if clause to exit if an answer given is anything but >> either any case combination of 'y' or 'yes'. This is what I have: >> >> exit if $ans =~ m/[^y|^yes]/i; >> >> Will that do what I want? > > If you want anything but a given pattern, the best way to do it is > usually by using the !~ operator. Thus, if you have a pattern $foo, > this matches that pattern: > > exit if $ans =~ m/$foo/i; > > . . . while this matches anything but that pattern: > > exit if $ans !~ m/$foo/i; >
Thanks. That looks like exactly what I was looking for. Mathew -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/