How about:
$proto = defined $opt_proto ? $opt_proto : 'tcp'Personally, though, I'd go for putting all your arguments in a hash, with a reference to the opt_arg value, the variable you want the final result in, and the default value, and use a for loop to rip through them setting them all. Perhaps include a type (numeric, string, flag) and do a little type checking. For instance, if someone passed '123' to the $opt_tcp value, it prolly ain't gonna work...
--Chris
In reply to (jcwren) Re: Reduce Redundant Repetition
by jcwren
in thread Reduce Redundant Repetition
by ybiC
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |