what does this perl snippet mean?

ucd_aggie_grad

New member
my $request = {
Service => 'this service',
Operation => 'add record',
Version => 'latest',
};

At first, it seems that the variable $request is a scalar variable. But on closer look, it seems to be a hash variable. Which is it?

Secondly, if I were to construct a variable ($request) with two arrays, say

@action = ("Service", "Operation", "Version");
@value = ("this service", "add record", "latest");

how would I go about doing so?

Thanks!
 
$request is a reference to a hash. Parens make a hash, curlies make a hashref. Parens also make a list, but square brackets make an arrayref.

Hey no fair asking two questions at a time!
You probably want to construct a variable with two REFERENCES to arrays... But it's your data structure, you can define it however you want!?!
 
Back
Top