in reply to can i get a matched values as an array
This is ugly, but does what you want in one step (ie.applies the regex and makes the matches available in an array.#!/usr/bin/perl use strict; my $i; my @values; my $string ="age 42 name Utilitarian FamilyName"; ($i,@values)= split(/age|name/, $string); for ($i=0;$i<@values;$i++){ print "$i, $values[$i]\n"; }
|
|---|