You need sprintf to assign to a scalar. You are getting the value 1 in your $line2 variable as that is what is returned by the successful printf that displays on your screen.
$ perl -E ' > my $line = 55743; > my $line2 = sprintf q{%#x}, $line; > say $line2;' 0xd9bf $
I hope this is helpful.
Cheers,
JohnGG
In reply to Re: getting wrong value
by johngg
in thread getting wrong value
by ggrise
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |