if I push @results1, @results2, do i get:
'employee1','address1','payrate1','hiredate1', 'employee2','address2','payrate2','hiredate2', 'employee3','address3','payrate3','hiredate3', 'employee4','address4','payrate4','hiredate4'
Well if you want a true multi-dimensional array, this isn't it. You just flattened it as MeowChow shows in Data::Dumper.
To have a multi-dimensional array you want
| 0 1 2 3 --------------------------------------------------- 0 | ['employee1','address1','payrate1','hiredate1'], 1 | ['employee2','address2','payrate2','hiredate2'], 2 | ['employee3','address3','payrate3','hiredate3'], 3 | ['employee4','address4','payrate4','hiredate4']
This is Array of Arrays - or more clearly an Array of scalars that contain Array Refs. The '[]' show an array reference.</>
To achive this you want
push(@AoA,\@result1,\@result2)So let's say you want 'address2', you can access it by:
my $foo = @AoA[1]->[1]HTH
| Unix - where you can throw the manual on the keyboard and get a command |
In reply to Re: Pushing multi-dimensional arrays onto each other
by grep
in thread Pushing multi-dimensional arrays onto each other
by cidaris
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |