For Programmers: Free Programming Magazines  


Home > Archive > PERL Programming > April 2004 > multiple commands in one printf statement.









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 multiple commands in one printf statement.
markscns

2004-04-01, 8:32 am

How would I combine them two lines into one, if possible at all.

printf ("%-15s%-20s"," ","The hex number is ");
printf "%x\n", 125.5;

The first statement, moves the line over, the second is the actual hex conversion.

Thanks
Gunnar Hjalmarsson

2004-04-01, 9:33 am

markscns wrote:
> How would I combine them two lines into one, if possible at all.
>
> printf ("%-15s%-20s"," ","The hex number is ");
> printf "%x\n", 125.5;


printf "%-15s%-20s%x\n", " ", "The hex number is ", 125.5;

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

markscns

2004-04-01, 3:32 pm

That's the ticket.

Thanks.

Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in message news:<c4h4d8$2hhhb7$1@ID-184292.news.uni-berlin.de>...
> markscns wrote:
>
> printf "%-15s%-20s%x\n", " ", "The hex number is ", 125.5;

Sponsored Links







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

Copyright 2008 codecomments.com