Leading zero with sprintf and option f.

2006-07-05 Thread John Hennessy
Hi, how is it possible to prefix a leading zero to the $Count result 
below when this value is less than 100. ?



while ($count  110.000) {
   $count += 10;
   $Count = sprintf %03.4f, $count;
   print Count is now $Count\n;
}

I am using %03.4f to provide output that looks like 100.
I would like number less than 100. to look like 099.
I would like to keep the 3 digits prior to the decimal point either with 
or without the leading zero as required.


Any suggestions welcomed.

Thanks

John.



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




Comparing Hashes with different keys. How ?

2003-12-16 Thread John Hennessy
Hi, I have two different hashes built from separate data and need to 
find the common then differing items.

$HoA1{$custnum} = [ $uid, $firstname, $lastname ];
$HoA2{$uid} = [ $custnum, $firstname, $lastname ];
I have looked at examples for Finding Common or Different Keys in Two 
Hashes but the keys must be the same.
To make the keys the same I would like to effect a reverse function but 
only reversing the key and the first value leaving the remaining array 
items in place.

Examples or suggestion would be most appreciated.
Thanks
John.





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



UNIX Domain Socket help required.

2002-05-29 Thread John Hennessy

Hi, I am looking for a good IO::Handle example for a simple client and
server.

I have checked the perlipc document but must still be missing 
something. It echoes data back to client ok but I simply need to have the server 
listening for client connections and print the data to another
filehandle. Bi-directional support is not required.

Thanks in advance.

John.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]