sanku has asked for the wisdom of the Perl Monks concerning the following question:

hi monks,
@query = @$seq;
can anybody tell me the meaning for the above code where as @query is an array where as what does @$seq means for. thanks in advance by sanku

Replies are listed 'Best First'.
Re: meaning of the following array
by Tux (Canon) on Feb 02, 2007 at 07:12 UTC
    This is valid if $seq is a reference to an (anounymous) array. This operation dereferences the reference.
    my @seq = ( 1 .. 5 ); my $seq = \@seq; # $seq is now a reference/pointer to @seq my @query = @$seq; # @query is now a copy

    my $seq = [ 1 .. 5 ]; # anonymous list my @query = @$seq; # @query is now ( 1 .. 5 )

    Enjoy, Have FUN! H.Merijn
        I would think that's why the "anonymous" part was in brackets?
      my $seq = [ 1 .. 5 ]; # anonymous list

      [ 1 .. 5 ] is anonymous array reference, not anonymous list.

Re: meaning of the following array
by davorg (Chancellor) on Feb 02, 2007 at 08:56 UTC
Re: meaning of the following array
by j3 (Friar) on Feb 02, 2007 at 18:41 UTC
    The trick is, @$seq is actually shorthand for @{$seq}.