I have an array of structs (from Class::Struct) and I am having trouble accessing their 'fields'. I've looked at other solutions such as Perl - Class::Struct Deferencing array and Perl documentation without success. My code is:
use Class::Struct;
use Data::Dump qw(dump);
struct( Tag => {
attributes => '%',
value => '$'
});
my @data = [];
push @data, Tag->new(attributes => { 'id' => 1 }, value => "hello world!");
dump @data;
my $tag = $data[0];
my $value = $tag->value;
print $value, "\n";
I've tried variations on blessing $tag with 'Tag' (since can't call value on unblessed ... is the current error), dereferencing $tag as a hash, and more.