my $thing; foreach (@array) { if (/^1006,(.*)/) { $thing=$1; last; } }