darkphorm has asked for the wisdom of the Perl Monks concerning the following question:
Where all works, except at line: $groups[$gcount]{sub}=@subgroup;sub sub_pick_group_seg { my ($str) = @_; my $working=$str; my @groups; while ( $working =~ s/<\@=([\w\d\_\ ]+)>(.*?)<\/\@=\1>/<\@=\1>/gs ) { my $name=$1; my $newvalue=$2; if ($name ne "") { my $gcount=@groups; my @subgroup; my $newvalue; ($newvalue, @subgroup)=sub_pick_group_seg ($newvalue); $groups[$gcount]{name}=$name; $groups[$gcount]{value}=$newvalue; my $subcount=@subgroup; if ( $subcount > 0 ) { $groups[$gcount]{sub}=@subgroup; } } } return ($working, @groups); }
my $arr= @group[$indx]; print "---*--- " . join(",", keys(%$arr) ) . "<br>\n"; print "--+ " . $$arr{name} . "<br>\n";
---*--- value,name<br> Bad index while coercing array into hash at ./mod/subst.cgi line 65.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Recursive function adds data to a hash/array
by kvale (Monsignor) on Mar 10, 2004 at 19:04 UTC | |
by darkphorm (Beadle) on Mar 10, 2004 at 20:10 UTC | |
|
Re: Recursive function adds data to a hash/array
by Happy-the-monk (Canon) on Mar 10, 2004 at 19:00 UTC | |
by Limbic~Region (Chancellor) on Mar 10, 2004 at 19:09 UTC | |
by BUU (Prior) on Mar 10, 2004 at 22:51 UTC | |
by Happy-the-monk (Canon) on Mar 10, 2004 at 19:16 UTC |