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

GrandFather, Your script is working just fine. I however am trying to take out the duplicate lines if exists above. I tried as following but giving me a hash error-
Original-
for my $list (@lists) { print $list->{line}; printGroups($list->{groups}, %group); print "\n"; }
with
sub uniq { my %seen; grep !$seen{$_}++, @_; } for my $list (@lists) { my @filtered = uniq(@lists); printGroups(@filtered->{groups}, %group); # prints acl lines AFTER object-groups print $list->{line}; print "line 54: ACL line\n\n"; }
Please let me know.

Replies are listed 'Best First'.
Re^3: Print lines based on matching words
by GrandFather (Saint) on Jul 11, 2016 at 21:09 UTC

    Add a minimum number of lines of code to initialize @lines with data built into the test code and ask again. I have no way of telling what the contents of @lines is, but it seems most likely it is an array of hash refs.

    Premature optimization is the root of all job security