Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2021-04-18 14:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?