in reply to Clean way of adding values to complex data structure
If you want to get really fancy, it can be a one liner, but I think that using logical connectives (and/or) for flow control hurts readability, especially in a complex statement with modifiers.for (@$pages) { $_->{flag} = 1 if $_->{url} eq "/html/about.html"; }
$_->{url} eq "/html/about.html" and $_->{flag} = 1 for @$pages;
blokhead
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Clean way of adding values to complex data structure
by Rodster001 (Pilgrim) on Jul 22, 2009 at 21:13 UTC |