Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Printing Last Element of a line using perl memory?

by BrowserUk (Pope)
on Feb 15, 2013 at 01:27 UTC ( #1018825=note: print w/ replies, xml ) Need Help??


in reply to Re: Printing Last Element of a line using perl memory?
in thread Printing Last Element of a line using perl memory?

Or if you want to reveal every character in your string's ascii code, you can do this: printf "%vd \n", $string;

Thanks for that. I had no idea it existed.

And (IMO) even better is that is led me to just try: printf "%vx\n", $s;. And whaddayaknow. It worked!

I'll be making much use of that in future.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re^2: Printing Last Element of a line using perl memory?
Select or Download Code
Re^3: Printing Last Element of a line using perl memory?
by 7stud (Deacon) on Feb 15, 2013 at 01:44 UTC

    You can even get a little fancier if you want:

    my $string = "\x15hello"; printf "%#*vx \n", " ", $string; --output:-- 0x15 0x68 0x65 0x6c 0x6c 0x6f

    And the printf() actually reveals every character's ord(), so it's not confined to ascii characters.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (14)
As of 2014-12-18 09:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (48 votes), past polls