|go ahead... be a heretic|
One-liners: Conditionals in Loopsby David Caughell (Monk)
|on Nov 04, 2003 at 20:45 UTC||Need Help??|
David Caughell has asked for the
wisdom of the Perl Monks concerning the following question:
I know that Perl has a miriad of shortcuts, and this is one of the reasons that I really like the language.
However, something that I think would be pretty cool, is if it was possible to write a conditional statement within a loop in a one-liner.
I haven't checked out the source code of perl, so I don't know how complex it would be to add something like this to the language (or how much slower a script would run).
Are there technical difficulties implementing something of this kind?
Are there reasons that doing something like this would be bad programming?
$scratchpad_public = 0 unless $scratchpad;