in reply to regex variables

In addition to what sauoq says, please note that for character classes you need to include square brackets. And your update routine is wrong. Presumably you want something like:
%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 } }
This will let you assign to var1 only if the value does not contain a digit.