printf returns 1 for a successful print, which is what you say happens. You probably want sprintf (note leading 's'), which returns a string.
Update:
>perl -wMstrict -le "my $line = 55473; my $line2 = sprintf '%#x', $line; printf qq{\$line is '%#x' \n}, $line; print qq{\$line2 is '$line2'}; " $line is '0xd8b1' $line2 is '0xd8b1'
In reply to Re: getting wrong value
by AnomalousMonk
in thread getting wrong value
by ggrise
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |