@{$_} dereferences the array reference created with [].  For instance,
my $ref = [1,2,3];
is the same as
my @arr = (1,2,3);
my $ref = [EMAIL PROTECTED];

To access the array (1,2,3) using $ref, you need to say @{$ref} or, to
access an individual element of it, you can say $ref->[0], $ref->[1],
etc...

So, you should be able to say:
foreach (@array) {
     $_->[1] = "00:00" if ($_->[1] == 0);
     print join (', ', @{$_}) . "\n";
}

If you want to make this a little more readable:
foreach (@array) {
     my @arr = @{$_};
     $arr[1] = "00:00" if ($arr[1] == 0);
     print join (', ', @arr) . "\n";
}

HTH
-David


On Wed, 13 Oct 2004 15:47:55 +0100, Beckett Richard-qswi266
<[EMAIL PROTECTED]> wrote:
> 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.
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to