Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Shift regex search back 4 characters...

by ablanke (Monsignor)
on Mar 08, 2017 at 10:54 UTC ( [id://1183936]=note: print w/replies, xml ) Need Help??


in reply to Shift regex search back 4 characters...

Hi,
maybe i'm simplifying your requirements too much or it's a matter of performance, but you could solve this by splitting the numbers.
#!/usr/bin/perl use strict; use warnings; my $numbers = '222,345,222,678,222,222,543,111,222'; my @numbers = split(',', $numbers); my $i = 1; for my $number (@numbers) { if ( '222' eq $number && $i < scalar(@numbers) ) { print "AFTER $number-$numbers[$i]\n"; } $i++; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-04-25 10:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found