The error is correct, because this expression: $#{@$head} does not do what you think it should. I assume you want the number of elements in @$head there. If head were an array, your code would look like this:
sub new { ... my @head = (1,2,3); my $cols = $#head; ... };
This already is wrong, because $#head is the index of the last element, so $cols will be 2, not 3. But to translate the code above, just follow References Quick Reference and write:
sub new { ... my $head = [1,2,3]; my $cols = $#{$head}; ... };
In reply to Re: Cannot find error : Can't use string ("9") as an ARRAY ref while "strict refs" ...
by Corion
in thread Cannot find error : Can't use string ("9") as an ARRAY ref while "strict refs" ...
by smoky
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |