Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Manipulating Array Indexes

by tybalt89 (Prior)
on Sep 07, 2020 at 22:16 UTC ( #11121466=note: print w/replies, xml ) Need Help??


in reply to Manipulating Array Indexes

What do you need an array for? Just use the string of data values you showed us.

#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11121442 use warnings; my $data = '1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,'; my $target = 5; print $data =~ /\b$target,((?:\d+,){3})/g, "\n";

Outputs:

6,7,8,4,3,2,

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2020-10-20 15:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (210 votes). Check out past polls.

    Notices?