On Tue, 2002-04-30 at 00:23, drieux wrote: > > On Monday, April 29, 2002, at 02:42 , Chas Owens wrote: > [..] > > > > EVAL METHOD > > #!/usr/bin/perl -w > > use strict; > > > > my @fred = "one,two,three,four"; > > > > for my $a (0..3) { > > eval "my \@array$a=split(/,/, \@fred)"; > > } > > > > for my $b (0..3) { > > eval qq(print \@array$a[\$b], "\\n"); > > } > > what does the error message: > > File "Jeeves:Users:drieux:perl:Begers:TwoIndirects.pl"; Line 25: Global > symbol "@a" requires explicit package name > > and > > File "Jeeves:Users:drieux:perl:Begers:TwoIndirects.pl"; Line 34: syntax > error near "@fred]" > > mean????
It means I shouldn't write code off the top of my head. Especially tricky eval code. Sigh. $a followed by [] makes the compiler think a is an array name. The correct code should look like (I think) eval("print \@array$a" . '[$b], "\n"'); > > > > > ARRAY OF ARRAYREFS METHOD > > #!/usr/bin/perl -w > > use strict; > > > > my @fred = "one,two,three,four"; > > > > my @array; > > > > for my $a (0..3) { > > $array[$a] = [split(/,/, \@fred]; > > } > > > > for my $b (0..3) { > > print @{$array[$b]}, "\n"; > > } > > this one also doesn't deconstruct the way you would prefer... Hmmm....This looks (emphasis on looks) right to me. I stuff a different arrayref into an array 4 times and then print each of those arrays. Well, who knows. My fried is brain. > > but I think we are pointing the cat in the right direction... > > ciao > drieux > > --- > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Today is Setting Orange the 47th day of Discord in the YOLD 3168 Fnord. Missile Address: 33:48:3.521N 84:23:34.786W -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]