Thank you so much - that has done the trick!!

I guess this is a common mistake that people who don't take the time to read the 
manual on references make!!

Thanks again,
Simon.


                                                                                       
                                                                         
                      Sudarshan                                                        
                                                                         
                      Raghavan                 To:       Perl beginners 
<[EMAIL PROTECTED]>                                                                   
 
                      <[EMAIL PROTECTED]        cc:                                     
                                                                         
                      .com>                    Subject:  RE: Array of Hashes           
                                                                         
                                                                                       
                                                                         
                      19/09/2002 23:35                                                 
                                                                         
                                                                                       
                                                                         
                                                                                       
                                                                         




On Wed, 18 Sep 2002, Simon Tomlinson wrote:

>
>
> Apologies, that was bad typing in my email.  I rearrange the algorithm to make it 
>easier to read.  Here is my exact source and the exact output.  Even without the 
>space there, it still doesn't work!!
>
> Any ideas?
> Simon.
>
>
> sub getEvents
> {
>   my @rows = &getDBTable($tbl_events);
>   my @colDefs = ("");
>   @colDefs = split(",",substr($rows[0], index($rows[0],":")+1));
>   my $rowCount = -1;
>   my @rowCols;
>
>   foreach $row (@rows)
>   {
>       if ($rowCount > -1)
>       {
>         my %tempCols = &getCols($row, @colDefs);
>
>         foreach $key (keys %tempCols)
>         {
>             print "WORKS: $key $tempCols{$key}<br>\n";
>         }
>         $rowCols[$rowCount] = %tempCols;

You are assigning a hash to a scalar here, you will have to assign the
reference of the hash instead.
$rowCols[$rowCount] = \%tempCols;

>       }
>
>        my %event = $rowCols[$rowCount];

And change this too
my %event = %{$rowCols[$rowCount]};

or

remove the my line and change the foreach as
foreach $key (keys %{rowCols[$rowCount]})

>        foreach $key (keys %event)
>        {
>            print "DOESN'T WORK: $key $event{$key}<br>\n";
>        }
>
>      $rowCount = $rowCount + 1;
>   }
>   return @rowCols;
> }


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






--

This e-mail may contain confidential and/or privileged information. If you are not the 
intended recipient (or have received this e-mail in error) please notify the sender 
immediately and destroy this e-mail. Any unauthorized copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to