in reply to Re^2: Subarray in a hash: Can't use string ("STRING") as a HASH ref while "strict refs" in use
in thread Subarray in a hash: Can't use string ("STRING") as a HASH ref while "strict refs" in use

( ) are used for assignments to arrays and hashes. [ ] are used for array references, { } are used for hash references. You are not assigning a hash, you are assigning a hash reference here.

Updated.

لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
  • Comment on Re^3: Subarray in a hash: Can't use string ("STRING") as a HASH ref while "strict refs" in use
  • Select or Download Code

Replies are listed 'Best First'.
Re^4: Subarray in a hash: Can't use string ("STRING") as a HASH ref while "strict refs" in use
by shawnhcorey (Friar) on Apr 08, 2014 at 14:22 UTC

    No, ( ) is used for lists. Lists are converted into arrays by assignment. Also, lists are converted into hashes by assignment.

    Example: note the addition of the `undef` to make the hash work properly.

    #!/usr/bin/env perl use strict; use warnings; use feature qw( :all ); # -------------------------------------- # Modules use Data::Dumper; # Make Data::Dumper pretty $Data::Dumper::Sortkeys = 1; $Data::Dumper::Indent = 1; # Set maximum depth for Data::Dumper, zero means unlimited local $Data::Dumper::Maxdepth = 0; # -------------------------------------- my @a = my %h = ( 1, 2, 3 ); say Dumper \@a; say Dumper \%h;