Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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.

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018825]
[stevieb]: ...from an I2C master. It's ugly and there are many changes I'm going to make, but I had not done anything like it before. It's designed for my RPi:: automated test platform; a system that does CI on *all* my RPi modules.
[shmem]: pseudo chip?
[stevieb]: well, what happens is the Arduino 'listens' for requests r/w, and does the appropriate thing when it's interrupted based on the 'register' address sent in. It's ugly as it was my first attempt, but I've got great new ideas I'm just sitting.
[stevieb]: ...down to implement now. Here's the sketch as it currently sits
[shmem]: well I use I2C and SPI and stuff, but creating a pseudo chip looks to me like lot of indirection and memory clutter... not?
[choroba]: Are you going to use the device soon? Related to your comment about "not having much time to do a lot of coding"...
[stevieb]: sure, but I'm just learning ;) I consider it practice to get a good understanding of what goes on *after* an I2C/SPI request is made
[shmem]: ah ok. Gonna read that. but now....
shmem compiles himself into his template
[stevieb]: this is my RPi:: distribution overall automation build system physical layout. It doesn't encompass all of my RPi dists yet, ...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2017-06-25 22:42 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (572 votes). Check out past polls.