Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Substr Problem

by Athanasius (Chancellor)
on Sep 27, 2012 at 02:19 UTC ( #995906=note: print w/replies, xml ) Need Help??


in reply to Substr Problem

Hello snape,

GrandFather’s solution is definitely the way to go. However, for the record, your code can be made to give the output you want by changing the substitution:

substr($VALUE, 2, 2) =~ s/0/$signal/g;

into a simple assignment:

substr($VALUE, 2, 3) = $signal;

By the way, the /g modifier on the substitution is redundant in this case.

Athanasius <°(((><contra mundum

Replies are listed 'Best First'.
Re^2: Substr Problem
by choroba (Chancellor) on Sep 27, 2012 at 08:32 UTC
    Or, even simpler:
    substr $VALUE, 2, 3, $signal;
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://995906]
help
Chatterbox?
[Eily]: I also like that this number appears right below "Priest"
[marinersk]: LOL OMG. I may have to create a new account and leave this one here.
[marinersk]: Or maybe I'll just not ever post again. That would make several Monks happy.
[hippo]: :-)
[Eily]: or you can set 999 as your next goal :P

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2017-05-29 15:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?