Hi all, > Let's start off with some simple code.. > > my $arg = &SomeFunction ( my @arry = qw/one two three/) > > sub SomeFunction { > my @array = @_[0]; > for (my $i =0; i < @array; i ++ ) { > print "$array[0][$i] > } > } > > Ok now I understand what the problem is, but I don't > know how to fix it. I only have a 1 x 3 array so only > "one" gets printed - instead of the desired > "one two three".. > > How do I fix this? This seems simple enough.. > # You need to pass a reference! my $arg = SomeFunction(\my @arry =qw/one two three/); sub SomeFunction { my $array = shift; # Iterate over rows foreach my $row (@{$array}) { # Iterate over columns foreach my $element (@{$row}) { print "$element "; } # Newline to start next row print "\n"; } } perldoc perlref # Read up on references Jonathan Paton __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.comThread Previous | Thread Next