if ($line =~ m/Trunk Group: (\w+)/) { my $match = $1; #do things with $match }