Don't ask to ask, just ask | |
PerlMonks |
Re^2: conditional print. Is correct to use it?by pvaldes (Chaplain) |
on Oct 27, 2020 at 21:45 UTC ( [id://11123237]=note: print w/replies, xml ) | Need Help?? |
Is more about style. I'm in the middle of an iteration. The known route would be: put an if loop before -> to fix $variable -> and then print "something $variable something"... to a file. I'm exploring to include the loop directly inside the print line. Start printing "something" to a file -> then include a mini loop to check the current status of the variable and then finish printing "something". what strategy would be more correct in your opinion? "if(true){a} else {b}" or just (a||b) (are both equally correct?) Note: (About why not write just: my $fo; I have a bunch of variables to initialize. Some are expected to be numeric, other will receive a chain. I want to remind who is who. This is the reason to express specifically the empty chain here. (i.e: my $fo = q{}; my $bar = 0;... instead to just write: my ($fo, $bar)
In Section
Seekers of Perl Wisdom
|
|