in reply to Code Cleanup challenge!
isn't doing what you expect it to. $regex ends up holding an anonymous array. You need something likemy $regex = $required_params{$param};
(You correctly use $required_params{$param}[1] later to pick off the size, which leads me to suspect that you're posting partially debugged code.)my $regex = $required_params{$param}[0];
Even then, the regex you're using looks suspect, unless you intend to allow a string that has at least one "word" character. Also, a match sets $1, which there's no evidence of the coding using.
My suggestion: Get this working first. Write unit tests if you have to. Then clean it up. You can try to worry about correctness and cleanliness at the same time, but my experience is that it'll take you 50% more time (or more) if you go that route.
|
|---|