On Aug 19, 11:16 am, [EMAIL PROTECTED] (Perry Smith) wrote: > My friend is trying to do this: > > #!/bin/perl > > $a = 1; > $b = 2; > $c = 3; > > @l = ( \$a, \$b, \$c ); > > # This is the line we need help with > # Is there a way to tell Perl that @l[0] is a reference > # and we want to assign what it refers to the number 4. > # i.e. ${$l[0]} = 4; > # but for the whole list in @l > ( \( @l ) ) = ( 4, 5, 6 ); > > print "$a should be 4\n";
It sounds to me like you're looking for the exact opposite of the \ ( ... ) behavior. That is, you want some operation that will take a list of references and return the corresponding list of referents. To my knowledge, no such operator exists. Sorry. You can dereference a single reference to an array. But you can't dereference a list of references to scalars. Best you could do would probably be something involving a postfix for, like: my @new_vals = (4, 5, 6); my $i = 0; ${$_} = $new_vals[$i++] for @l; Paul Lalli -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/