Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: getting wrong value

by johngg (Abbot)
on Jan 15, 2013 at 22:59 UTC ( #1013466=note: print w/ replies, xml ) Need Help??


in reply to getting wrong value

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


Comment on Re: getting wrong value
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1013466]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2015-08-01 02:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (285 votes), past polls