Subject: RE: Help with array of arrays!

Thanks to all those who helped, so far! :-)

foreach ( @array ) {
   print join ( ", ", @{$_} ), "\n";
}

This is the nice easy print statement I was looking for, but I don't quite
understand it. I get the print, and the join, but what is @{$_} all about?

Going back to the array:

1/1/2004 0 34.5
1/1/2004 1 54
...

If I wanted to change element 2 to 00:00 only if it was 0...
1/1/2004 00:00 34.5
1/1/2004 1 54
...

How would I do that?

This doesn't work, but gives the gist...

for (@array) {
   if (@[$_][1] == 0) [EMAIL PROTECTED] = "00:00"};
   print join (', ', @{$_}) . "\n";
}

Thanks.

R.

You didn't keep the thread so I'm not sure how you got to your questions but
...

@{$_} is a dereference... a reference to an array... 

I believe you originally ask how to handle a variable number of arrays with
a variable number of elements in each list...

So... I demonstrated an array of references - if you just push an array into
another array you would loose the number of elements in each array (you said
that each array could be variable). So again @array=([EMAIL PROTECTED],[EMAIL 
PROTECTED],...)
- an array of references to variable length arrays... 

See perldoc perlref ... 

"==" is the perl numerical compare operator - perldoc perlop says "Binary" -
while "eq" is a string compare... what do you have in the array - a string
or a number ? 00:00 is not a number... You can't say $a=00:00; 

Does this help?

jwm
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to