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

Re: Changing the numerical value from 0 to 1

by Kenosis (Priest)
on Jan 21, 2014 at 01:35 UTC ( [id://1071412]=note: print w/replies, xml ) Need Help??


in reply to Changing the numerical value from 0 to 1

You could match w/word boundaries:

for (@output5b) { s/\b0\b/1/ };

Or you could match from start to end:

for (@output5b) { s/^0$/1/ }

Or w/o a regex:

for (@output5b) { $_ = 1 if $_ == 0 }

Edit: I believe that ww and kcott provided sufficient reasons below to keep only option #2.

Replies are listed 'Best First'.
Re^2: Changing the numerical value from 0 to 1
by hellohello1 (Sexton) on Jan 21, 2014 at 02:21 UTC
    Word boundaries work !:) Thanks!

      You're most welcome.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-03-29 07:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found