http://www.perlmonks.org?node_id=614573


in reply to Regex problem

Hi, try like this,

use strict; use warnings; while (<DATA>){ if ($_ =~ m/^00CH,Gateshead MCD,([^\n]+)/){ my @pos = split/\,/, $1; print "Position : $_ \t $pos[$_]\n" for (0..$#pos); } print '-' x 90, "\n"; } __DATA__ 00CH,Gateshead MCD,619,172.90,158.94,186.87,,537,87.42,79.61,95.23,,11 +56,126.89,119.29,134.50 00CH,Gateshead MCD,69,12.90,158.94,186.87,,537,87.4,7.61,95.23,,116,12 +6.89,19.29,14.50

Regards,
Velusamy R.


eval"print uc\"\\c$_\""for split'','j)@,/6%@0%2,`e@3!-9v2)/@|6%,53!-9@2~j';