For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > July 2005 > RE: Replacing printf by print









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author RE: Replacing printf by print
Pradeep Goel

2005-07-24, 8:29 pm


Thanks a million.

Best Regards,
Pradeep

-----Original Message-----
From: Jeff 'japhy' Pinyan [mailto:japhy@perlmonk.org]=0D
Sent: Friday, July 22, 2005 6:00 PM
To: Pradeep Goel (WT01 - TELECOM SOLUTIONS)
Cc: beginners@perl.org
Subject: RE: Replacing printf by print

On Jul 22, pradeep.goel@wipro.com said:

> I am replacing it since there are some % sign in the strings being
> passed making the program crash. Replacement solves the problem as

such,
> but wanted to countercheck, If these replacements could create any
> problem anywhere else! , or lator in the program?


The only problem there might be is that print() is susceptible to to the

$, and $\ variables. The $, variable defines what gets printed in
between=0D
the list of strings you pass to print(), and $\ defines what gets
printed=0D
after the strings you pass to print(). Both default to the empty
string,=0D
but if you were to change them, for some reason, print()s output would
be=0D
affected (but printf()s would not).

print "a", "b", "c"; # abc

$, =3D "!";
print "a", "b", "c"; # a!b!c

$\ =3D "?";
print "a", "b", "c"; # a!b!c?

But this is not likely to happen, methinks.

--=0D
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



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@wipro.com immediately
and destroy all copies of this message and any attachments.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com