Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Substr Problem

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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (11)
As of 2015-10-06 16:58 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (155 votes), past polls