What does it mean when a Perl method returns a "hashref"?
- by Uri
I'm trying to decrypt a Perl code which I'm not familiar with, somehow related to HashRef.
I'm using Amazon::S3, but my question is a general Perl question. See the code below:
use Amazon::S3;
my $s3 = Amazon::S3->new( ... );
my $response = $s3->buckets;
Documentation (here) sais, about s3-buckets:
Returns undef on error, else HASHREF of results
The following line is working for me, but I don't understand why:
for $b in ( @ { $response->{buckets} } ) {
print "bucket: " . $b->bucket . "\n";
}
I'm Puzzled by each operator on the first line.
What type exactly are $response, $respone->{bucket}.
Looks like the expression within the for is an array, but I don't understand this syntax: @{ ... }?