If ($lines[2] =~ "radioChannelProperty") { print "$lines[2]"; OR if ($lines[3] =~ "radioChannelProperty") { print "$lines[3]"; OR etc...