in reply to Re: Hash Ref Error
in thread Hash Ref Error

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:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^3: Hash Ref Error
by stevieb (Canon) on Sep 15, 2015 at 22:29 UTC

    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.