perl mulitdementional array
i have a sub that returns an array like this
@x=array(array("1","2","3")); not correct syntax, but it shows how it is returned. i want to travers through just the first element of array x. when i do [CODE] @y=@x[0]; foreach(@y){ print($_."\n"); } [/CODE} it will just print out somethign ot the extent of ARRAY(0x98e2708) but if i print $x[0][1] it will print fine... how can i travers though x[0]? |
Effectively, you have to 'cast' the array ref $x[0] to an array viz:
Code:
@y = @{$x[0]}; |
you should ask what you want to do, not how you want us to do it.
there may be be a simpler way. |
All times are GMT -5. The time now is 09:32 AM. |