display(@data); #### for my $dir (@dirs){ # idiomatic perl way to loop over a list print "$dir\n"; } #### sub display { # pull out the aref passed in my $dirs = shift; # could also be `my ($dirs) = @_;` # loop over the aref. Note the syntax # could also be written with the circumfix operator: # @{ $dirs } for my $dir (@$dirs){ print "$dir\n"; } }