Replcaing printf by print

Hi,

Does replacing printf by print make any difference in the program?
Especially at places where there is no format string passed or just $_
is passed?

Regards,
Pradeep



Confidentiality Notice=0D

The information contained in this electronic message and any attachments to=
this message are intended
for the exclusive use of the addressee(s) and may contain confidential or=
privileged information. If
you are not the intended recipient, please notify the sender at Wipro or=
Mailadmin [at] wipro.com immediately
and destroy all copies of this message and any attachments.

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>
pradeep.goel [ Fr, 22 Juli 2005 13:50 ] [ ID #891119 ]

Re: Replcaing printf by print

On Jul 22, pradeep.goel [at] wipro.com said:

> Does replacing printf by print make any difference in the program?
> Especially at places where there is no format string passed or just $_
> is passed?

It probably doesn't have a noticeable difference unless you compare the
running of it many, MANY times. But using printf() needlessly is silly,
and in some cases, dangerous. If you have a % sign in your string, printf
will expect an argument to go with it.

--
Jeff "japhy" Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ % -- Meister Eckhart

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>
japhy [ Fr, 22 Juli 2005 14:00 ] [ ID #891120 ]

Re: [SPAM DETECT] Re: Replcaing printf by print

On Jul 22, 2005, at 14:00, Jeff 'japhy' Pinyan wrote:

> On Jul 22, pradeep.goel [at] wipro.com said:
>
>
>> Does replacing printf by print make any difference in the program?
>> Especially at places where there is no format string passed or
>> just $_
>> is passed?
>>
>
> It probably doesn't have a noticeable difference unless you compare
> the running of it many, MANY times. But using printf() needlessly
> is silly, and in some cases, dangerous. If you have a % sign in
> your string, printf will expect an argument to go with it.

Just for the record, another formal difference is that printf does
not add $\, which might not be a problem anyway.

I second the remark of japhy, be specific, use print when you mean
print.

-- fxn

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>
Xavier Noria [ Fr, 22 Juli 2005 14:40 ] [ ID #891123 ]
Perl » gmane.comp.lang.perl.beginners » Replcaing printf by print

Vorheriges Thema: setting a user passwd
Nächstes Thema: RE: Replacing printf by print