> > What is the difference. The only I see is that printf can 
> 
> One difference is printf prints it's output and sprintf returns it';s
value.
> 
> printf ...
> my $formatted_goodies = sprintf ...
> 
> > take a filehandle? But what use would that be. 
> > 
> 
> To format the contents of it. For instance, you might have a user
enter a dollar amount from the command line.
> If you could printf STDIN the you could make sure 123.4567890 came out
as $123.46
> 
> Just one quick idea..
> 
> DMuey
> 
> >  Paul Kraus

Though you could try it, I did not, I don't think you can printf STDIN
since it is an inbound IO pipe as opposed to outbound.  This is a good
demonstation of the all important comma operator.  Notice the difference
in the docs:

printf FILEHANDLE FORMAT, LIST
printf FORMAT, LIST

In the first there is NO comma following the filehandle, this means it
is interpreted in a different manner than the rest of the argument list,
or probably to be more precise isn't an argument at all... I am sure one
of the gurus will chime in with the actual technical name of what this
spot is actually called in this context since I either don't know or it
escapes me currently.

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to