in reply to Perl data types and references
my (@sargs) = @_; is it equivalent with : my @sargs = @_; ? (without bracket)yes
After there is : my $config = {"delete" => 0, soFiles => []}; Is it right that $config is a hash table ? I have a doubt, because I would write : my %config = ( "delete" => 0, soFiles => [] );$config is a hash reference, you create it with {}.
is these 2 lines are equivalent ? my $config = {"delete" => 0, soFiles => }; my $config = {"delete" => 0, "soFiles" => };yes, => is a synonym for the comma, expect that any word to the left of it is interpreted as a string. But you need a value to the right of => or your hash is not created correct use use warnings;.
After that, delete is initialized like this : $config->{delete} = 1; # why -> is it a reference ? why not to use : $config{delete} = 1 ?You created it as a has reference with the {}.
my %conf = ( abc => 12 ); print $conf{abc}; # this is a hash my $conf_ref = { abc => 13 }; print $conf_ref->{abc}; # conf_ref is a reference to a hash
|
|---|