: if ($oldLot[1] == 0)
: {
:   $arpCount = $arp{$lot};   ==> Part 1
: }
: else
: {
:   $arpCount = "-";          ==> Part 2
: }
: 
: printf "%3s %3d   ", $arpCount, $count;
: 
: My problem occurs in the  "printf" at the "%3s". Here
: is the situation: When $oldLot[1] == 0, $arpCount is
: equal to an integer, but when $oldLot[1] != 0
: $arpCount is equal to a character. the printf
: foramtting will only allow me to print 'either' a
: character or an integer. how can I do both or how can
: I change the integer into a character variable so that
: it will work under the %s?

Not sure what the problem is. %3s should be able to take a number
or a string.

But if you want to be absolutely sure you're stringifying
the number, you could use an extra sprintf:

$arpCount = sprintf "%3d", $arpCount if $arpCount ne '-';
printf "%3s %3d   ", $arpCount, $count;

-- tdk

Reply via email to