my $answer= grep /^1006,/, @array; my $thing = substr($answer, 6,6);