http://www.perlmonks.org?node_id=1229316

aswingeo has asked for the wisdom of the Perl Monks concerning the following question:

is the example below which I got from internet correct? My doubt is - when subroutine scope is lost,@array no more remains valid.Hence returning its reference does make any sense ? Please help .

sub return_array { my @array = (1, 2, 3); foreach my $element (@array) { calculate($element); } return \@array; }