Shawn H Corey <shawnhco...@gmail.com> writes: > On Mon, 18 Aug 2014 16:17:53 +0800 > Ken Peng <o...@dnsbed.com> wrote: > >> sub myfunc { >> my @x=(1,2,3); >> return \@x; >> } >> >> # or, >> >> sub myfunc { >> my @x=(1,2,3); >> return [@x]; >> } > > # or > > sub myfunc { > return [ 1, 2, 3 ]; > }
Is there a difference to sub myfunc { return ( 1, 2, 3 ); } ? And my understanding was/is that in sub myfunc { my @x=(1,2,3); return \@x; } a reference would be returned to an array that ceases to exist when the function returning it has finished. At the point the function returns to, there isn't anything left the reference could refer to. Or is there? -- Knowledge is volatile and fluid. Software is power. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/