How to dereference hash references

后端 未结 3 706
难免孤独
难免孤独 2021-01-26 00:05

UPDATE: Everything I know about referencing/dereferencing came from here: http://www.thegeekstuff.com/2010/06/perl-array-reference-examples/

I\'m working with a library

3条回答
  •  不知归路
    2021-01-26 00:45

    my $hash_ref = @{$result};
    

    is the same as

    my @array = @{$result};
    my $hash_ref = @array;
    

    This forces the array to be evaluated in scalar context by the assignment operator, which causes it to evaluate as the number of items in the array, or 1.

提交回复
热议问题