in reply to Re^3: Print lines based on matching words
in thread Print lines based on matching words

Thank you for your reply. That's a nice way to match the rest.
I however, using the following as it seems to fit my needs-
while (defined(my $line = <$fh>)) { next if $line =~ /^access-list .*\bremark\b/; given ($line) { when (/^access-list/) { # take the next word followed by object-group /object-group\s/; my @after = split(/\s/,$'); my @keys = @after; push @lists, {groups => \@keys, line => $line}; } ............... } }