Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Shift regex search back 4 characters...

by ablanke (Vicar)
on Mar 08, 2017 at 10:54 UTC ( #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
Node Status?
node history
Node Type: note [id://1183936]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2020-05-28 22:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (166 votes). Check out past polls.

    Notices?