Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: numbers masking

by poj (Prior)
on May 16, 2012 at 07:47 UTC ( #970769=note: print w/replies, xml ) Need Help??


in reply to numbers masking

You could split the string, process each character skipping over the non-digits and then join back together.
#!perl use strict; my $Number = ' 5 4 1 321 0 698 7 3 210 2 0 0'; my @Number = split //,$Number; my $count = 0; for my $i (0..$#Number){ next if ($Number[$i] =~ /\D/); if (($count > 5) && ($count < 14)){ $Number[$i] = "X"; } ++$count; } print join '',@Number;
poj

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://970769]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2017-11-23 18:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (337 votes). Check out past polls.

    Notices?