Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Substr Problem

by Athanasius (Monsignor)
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


Comment on Re: Substr Problem
Select or Download Code
Re^2: Substr Problem
by choroba (Abbot) 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?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (15)
As of 2014-12-18 11:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (50 votes), past polls