[EMAIL PROTECTED] (John Edwards) writes:

> It means treat the value in $row as a reference to an array. If you print
> out $row you will get something that looks like this.
> 
> ARRAY(0x369ab0)
> 
> Try altering your code to this
> 
> foreach $ts ($te->table_states) {
>    print "Table (", join(',', $ts->coords), "):\n";
>    foreach $row ($ts->rows) {
     foreach $row_ref ($ts->rows) {

>       my @row = @$row;
        my @row = @$row_ref;

>       print @row;
>       
>       print join(',', @row), "\n";
>    }
>  }
> 
> You can now work on @row within the foreach instead of the dereferenced
> @$row.

I had a lot of trouble with references when I first started
using them.  I found that choosing unambiguous names helps a
lot.  I put "_ref" in all my reference variables.

It's sometimes more confusing to have two variable spelled
the same.  John got away with it because one was a scalar
and one was an array.

I like the "trick" of dereferencing the reference directly
into an array.  It jumps you out of what's hard for you now
(references) into what's more comfortable (arrays).  Do it
often enough and you won't *need* the intermediate step any
more (like me) though you'll have the freedom to *choose*
either way (like me).

-- 
Michael R. Wolf
    All mammals learn by playing!
        [EMAIL PROTECTED]

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

  • @$ McCollum, Frank
    • RE: @$ John Edwards
      • Michael R. Wolf

Reply via email to