develooper Front page | perl.beginners | Postings from October 2009

Re: Need explanation about this code.

Thread Previous | Thread Next
From:
John W. Krahn
Date:
October 8, 2009 10:37
Subject:
Re: Need explanation about this code.
Message ID:
4ACE2331.6040103@shaw.ca
Raheel Hassan wrote:
> Hello,

Hello,

> I have problems in understanding $#{@$ use ?????
> 
> 1- my $ref = $$temp_sth -> fetchall_arrayref({});
>     for(my $i=0; $i <= $#{@$ref}; $i++) {
>     push(@$temp_table,$ref->[$i]);}

$#{@$ref} should be $#{$ref} or simply $#$ref

And

for(my $i=0; $i <= $#{@$ref}; $i++) {

should be

for my $i ( 0 .. $#$ref ) {

And

      for(my $i=0; $i <= $#{@$ref}; $i++) {
      push(@$temp_table,$ref->[$i]);}

should be

      push @$temp_table, @$ref;




John
-- 
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity.               -- Damian Conway

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About