Chris Rogers wrote:
> Hi all,
>
> I backed myself into a corner and cold use a little help. I have a
> multi-dimensional array that has a know number of elements at the deepest
> level but the number of levels is unknown. Here is a brief example:
there are a number of ways of doing what you want. have you try Data::Dumper
yet? it might help... Otherwise, try print out the whole thing like:
#!/usr/bin/perl -w
use strict;
my $a = [[[[[[1,2],[3,4],[5,[6,7]]]]]]];
print_it($a);
sub print_it{
foreach my $i (@{shift()}){
print_it($i),next if(ref $i);
print "$i\n";
}
}
__END__
prints:
1
2
3
4
5
6
7
doesn't matter how many levels deep the array reference is...
As i said before, there are many other ways of doing the same thing. :-)
david
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]