in reply to Can a large subroutine be split in two (e.g. parent and child relationship)?
The example is quite silly, but i often use this technique to simplify code. It is useful, if $inner has no sense outside outer.#!/usr/bin/perl print outer('John', qw/dog car home/), "\n"; sub outer { my $name = shift; my @items = @_; my $inner = sub { return "$name\'s $_[0] "; }; return map {$inner->($_)} @items; }
|
|---|