use strict; use warnings; my @accounts = [ [ current => 1000 ], [ savings => 2000 ], [ other => 500 ], ]; foreach my $sub_ref (@accounts) { printf "%-10s | %10d\n", $_->[0], $_->[1] for @$sub_ref; } #### current | 1000 savings | 2000 other | 500 #### foreach my $sub_ref (@accounts) { printf "%-10s | %10d\n", @$_ for @$sub_ref; }
## current | 1000 savings | 2000 other | 500 ##
## foreach my $sub_ref (@accounts) { printf "%-10s | %10d\n", @$_ for @$sub_ref; }