http://qs321.pair.com?node_id=11105064


in reply to Re: regex return true instead of false (precedence)
in thread regex return true instead of false

The easiest way to get around precedence-issues is to define precedence yourself by using (a lot of) brackets. So

unless (! $args =~ /\-rs(\s+)(\S+)/ && ! $args =~ /\-p(\s+)(\S+)/ && ! + $args =~ /\-P(\s+)(\S+)/) {
will become
unless ((!($args =~ /\-rs(\s+)(\S+)/)) && (!($args =~ /\-p(\s+)(\S+)/) +) && (!($args =~ /\-P(\s+)(\S+)/))) {
I agree it looks a bit confusing, but modern editors help you by showing the matching bracket. And you don't have to think about rules (which might be counter-intuitive (like ! vs =~) or different in other programming languages).

HTH, Rata