http://qs1969.pair.com?node_id=498576


in reply to Re: simplify the code
in thread simplify the code

I wrote basically the same solution, but like having the loop variable (esp. since there's a use of $_ in the map.)

We both changed the conditional in different ways, from ne '' in the original to evaluates true in yours, and to existence in mine.

for my $hashref (@$sur) { if (exists $hash1{$hashref->{three}}) { $hash1{$hashref->{three}} .= "####$hashref->{four}"; } else { $hash1{$hashref->{three}} = join '<-->', map $hashref->{$_}, (qw(o +ne two four)); } }