#!/usr/bin/perl -w use strict; use Data::Dump qw(pp); my ($arrayRef, $hashRef) = makeBothTypes(); sub makeBothTypes { my $rowName = 'A'; my @twoDarray; my %twoDhash; while () { my @row = split; # no chomp needed for default split push @twoDarray, \@row; $twoDhash{$rowName++} = \@row; } return (\@twoDarray,\%twoDhash); } print pp($arrayRef); print pp($hashRef); print "\n"; print "$hashRef->{B}[2]\n"; #23 print "$arrayRef->[1][2]\n"; #23 =output that this prints.... [ [11, 12, 13, 14, 15, 16, 17], [21, 22, 23, 24, 25, 26, 27], [31, 32, 33, 34, 35, 36, 37], [41, 42, 43, 44, 45, 46, 47], [51, 52, 53, 54, 55, 56, 57], ]{ A => [11, 12, 13, 14, 15, 16, 17], B => [21, 22, 23, 24, 25, 26, 27], C => [31, 32, 33, 34, 35, 36, 37], D => [41, 42, 43, 44, 45, 46, 47], E => [51, 52, 53, 54, 55, 56, 57], } 23 23 =cut __DATA__ 11 12 13 14 15 16 17 21 22 23 24 25 26 27 31 32 33 34 35 36 37 41 42 43 44 45 46 47 51 52 53 54 55 56 57