Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: String regex replacement

by Ratazong (Monsignor)
on Feb 24, 2014 at 09:17 UTC ( #1075957=note: print w/replies, xml ) Need Help??


in reply to String regex replacement

I assume you just want to "nullify" the last 3 digits of your numbers. You could do it with the following code:

my @strings=("500", "988", "1210", "1300", "2000"); foreach my $in (@strings) { print "$in "; $in =~ s/(\d\d\d)$/000/; # take the last 3 digits, replace them w +ith 000 print "-> $in\n"; }
hth! Rata

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2018-08-14 19:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:









    Results (155 votes). Check out past polls.

    Notices?