#!/usr/bin/perl use warnings; use strict; my @b = myfunc(); foreach my $i (@b) { print "$i\n"; } sub myfunc { my @a = (1, 2, 3, 4); return @a; }