Your problem is that you are returning prematurely.
sub list { my @zfs_temp = `zfs list`; my (@name, @used, @available, @refer, @mount);
Otherwise, you simply return after going through the cycle once, perhaps not what you want.
In addition, you must declare these arrays with my . Otherwise, Perl will complain about use strict , which you should always use.
Welcome to Perl!
Edit:
As Joel pointed out, you probably want to return references to these arrays. This is pretty easy to do, just use:
return (\@name, \@used, \@available, \@refer, \@mount);
Refuse perlref if you are confused with this.
source share