in reply to Repeating regex assign to a list
Not entirely clear what you want... so I'm guessing a bit.
and the output is:#!/usr/bin/env perl5.22.1 use strict; use warnings; use 5.10.1; my $x ="aaa bbb ccc dd ee ff dd TAG=lls foo TAG=some randome tag TAG=l +ast_tag"; #my $x ="TAG=lls foo TAG=some randome tag TAG=last_tag"; my @tags = split /\s*TAG=/, $x; # before the first TAG, discard. shift @tags; my $i = 0; say "tag ", $i++, ": [$_]" for @tags;
Is that what you're looking for?tag 0: [lls foo] + tag 1: [some randome tag] tag 2: [last_tag]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Repeating regex assign to a list
by iang (Sexton) on Mar 04, 2016 at 18:49 UTC | |
by AnomalousMonk (Archbishop) on Mar 04, 2016 at 20:11 UTC |