in reply to Re^3: 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

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;
  • Comment on Re^4: Subarray in a hash: Can't use string ("STRING") as a HASH ref while "strict refs" in use
  • Download Code