in reply to Hash Ref Error

Your code works fine for me - what version of perl are you using?

Replies are listed 'Best First'.
Re^2: Hash Ref Error
by AnomalousMonk (Archbishop) on Sep 15, 2015 at 22:03 UTC

    The OPed code should work fine with any Perl version:

    c:\@Work\Perl>perl -wMstrict -MData::Dump -le "print qq{perl version: $] \n}; ;; my %my_data = (names => 'AbCdEfGh', states => 'FooBarBaz'); my $my_data_ref = \%my_data; ;; my @all_names = split /(?=[[:upper:]])/, ${ $my_data_ref } { names }; dd \@all_names; ;; my @ra = split /(?=[[:upper:]])/, $my_data_ref->{states}; dd \@ra; " perl version: 5.008009 ["Ab", "Cd", "Ef", "Gh"] ["Foo", "Bar", "Baz"]
    (5.8 is the earliest I can test.)


    Give a man a fish:  <%-{-{-{-<

      After assuming that $some_data is a single string with newlines, I can also confirm it works on v5.8, v5.18 and v5.22.