Angel has asked for the wisdom of the Perl Monks concerning the following question:
Is this good programming stype or am I shooting my self in the foot for later?#my idea %character_tests{ "var1" , "^0-9", "var2" , "^A-Za-z0-9\." ); #object update nethod # ARGS: variable name , variable value # RETURNS: 1 if sucessful, undef if not # sets error vars not described here sub update( $ ) { if( $_[0] =~ /$character_tests{ $_[0] )/ ) { &set_error_type = "illegal characters"; } else { $self->{var1} = $_[0]; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex variables
by sauoq (Abbot) on Nov 18, 2002 at 20:35 UTC | |
|
Re: regex variables
by Thelonius (Priest) on Nov 18, 2002 at 21:08 UTC | |
|
Re: regex variables
by Courage (Parson) on Nov 18, 2002 at 20:32 UTC | |
|
Re: regex variables
by John M. Dlugosz (Monsignor) on Nov 18, 2002 at 21:48 UTC |