"be consistent" | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
This is not unlike just saying $x although they are not interchangable (don't as my why, I am still trying to grok details like this myself). There are two differences that I can see between *$x and $x. The first is parameter checking:
fooprintf will take any LIST of arguments and will just trust you the the first item in the (flatened) list is a scalar, while barprintf will force you to give it a scalar as it's first argument, or force you to flaten any arguments you pass it your self. In some cases this could catch at compile time errors that Perl5 would not have caught until runtime. (can you see the uncaught error in printf $format @data or the reverse printf $filehandle, @both?) The other issue is context, ponder these:
If your intent was to print out the current seconds then the fooprintf will work, if however you were looking for the strigified representation of the current time barprintf is will likely be closer to what you expected. In reply to Re^2: Perl6 dot syntax (for methods?)
by Ven'Tatsu
|
|