in reply to Re: "Correct" program style questions
in thread "Correct" program style questions
my ( $color ) = (param('color') || '') =~ /^([[:alpha:]]+)$/;
That's an interesting line. My only immediate problem with it is that we come closer to obfuscating the code. People will likely understand the intent, but not necessarily see the subtleties. For instance, $color will be undef and not the empty string, if param('color') doesn't return anything. However, if the regular expression was stripped from the end of that, then $color would indeed default to the emptry string. Of course, I can't say that mine is much clearer in that regard.
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.