>>>>> "PP" == Philip Potter <philip.g.pot...@gmail.com> writes:
PP> On 12 April 2010 07:55, Uri Guttman <u...@stemsystems.com> wrote: >>>>>>> "PP" == Philip Potter <philip.g.pot...@gmail.com> writes: >> >> PP> On 12 April 2010 04:31, Uri Guttman <u...@stemsystems.com> wrote: >> >>>>>>> "AM" == Abimael Martinez <abijr....@gmail.com> writes: >> >> >> >> AM> print {$tmp} "$div_start"; >> >> >> >> no need for the {} around a single scalar handle. >> >> PP> But it *does* comply with Perl Best Practices #136. >> >> PP> * It makes the filehandle obviously different from the other arguments >> PP> * It makes you less likely to accidentally put a wrong comma in: >> PP> print {$tmp}, $div_start; >> PP> * If you forget a comma on a print statement where you just meant to >> PP> print to STDOUT, it stands out as being wrong: >> PP> print $arg1 $arg2; # should have been print $arg1, $arg2; or print >> PP> {$arg1} $arg2 >> PP> * IOW, it forces you to be more explicit about when you are printing >> PP> to a fh and when you are printing to STDOUT. >> >> PP> So there's at least 2 other people out there (Damian and me) who think >> PP> the OP's version is reasonable. >> >> and did you see my much shorter answer with no file handles at all?? PP> How is that relevant to my point? because your point is moot with the much better solution. the OP is wandering around the woods with IO::File and handles and he doesn't even need them. also i didn't even mention that if you do use handles, you can do direct method calls which are even better than indirect with {}. indirect method calls are just fugly in perl and can cause problems in some cases (not with print but with regular classes/methods. so it is BEST to never even use them if you can help it. $fh->print works as long as the handle is opened normally and you load the IO::Handle module (or something similar). hell, i rarely use anything but write_file these days so don't have to worry about it. >> and PBP isn't always right. it is meant as a list of interesting >> suggestions to pick and choose from. read the intro to get that. also >> note that i was one of the tech editors of that book. i know it >> well. and i disagree with some of it too. damian is fine with that. :) PP> Where did I say PBP was always right? I just didn't want to let your PP> style argument be the only one in this thread, since there are clearly PP> people who disagree with you, too. TIMTOWTDI. i disagree with myself most of the time! i am my own stupid boss and stupid worker. try that on for size! :) uri -- Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/