sub first_way { my @list; ... add elements to @list... \@list; } sub second_way { my @list; ... add elements to @list... [ @list ]; }