This will let you assign to var1 only if the value does not contain a digit.%character_tests = ( var1 => qr/[^0-9]/, var2 => qr/[^A-Za-z0-9\.]/ ); sub update( $ ) { if( $_[1] =~ /$character_tests{ $_[0] )/ ) { &set_error_type = "illegal characters"; return undef; } else { $self->{$_[0]} = $_[1]; return 1; # to match your spec } }
In reply to Re: regex variables
by Thelonius
in thread regex variables
by Angel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |