my ($s1, $s2, $s3, $pname, $index) = split(/,/, $line); #### ('AA', 'B','2','ProjectId','148')"> Unique Information Here (Index) #### my ($before, $after) = split(/>/, $line); my ($s1,$s2,$s3,$pname,$index) = split (/,/, $before); and then just trim off the ',), and " characters from $index.