in reply to can i get a matched values as an array

Hi balakrishnan, To the best of my knowledge you can't use a substitution. however you could use split to achieve this.
#!/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"; }
This is ugly, but does what you want in one step (ie.applies the regex and makes the matches available in an array.