On Sat, Mar 27, 2021 at 4:35 AM Darren Duncan <darren@darrenduncan.net> wrote: > So which of these is considered better code? > > Functional design: > > my $result1 = op2(op1($input1)); > > my $result2 = [map { op2(op1($_)) } @{$input2}]; > > Procedural design: > > my $result1 = $input1; > op1($result1); > op2($result1); > > my $result2 = []; > foreach $elem (@{$input2}) > { > op1($elem); > op2($elem); > push(@{$result2}, $elem); > } > I don't think anyone is arguing for the latter. Try this instead: Chomp-like design: op2(op1(my $result1 = $input1)); op2(op1(my @result2 = @input2)); EirikThread Previous | Thread Next