in reply to SOLVED: Get a list attributes from a given tag in Mojo::DOM

See Mojo::DOM->attr.

my $hash = $dom->attr; say $_ for keys $hash->%*; # for Perl since 5.36 say $_ for keys %$hash; # for all versions of Perl

Replies are listed 'Best First'.
Re^2: Get a list attributes from a given tag in Mojo::DOM
by igoryonya (Pilgrim) on Jun 13, 2024 at 10:50 UTC
    Ye, I got rusty. Forgot about hashref :)
    Is $dom supposed to be?:
    my $dom = Mojo::DOM->new($data)
    from my example?

      The "main" DOM for the whole document is my $dom = Mojo::DOM->new($data);. Then you likely want to ->find() some element in it, which again is a Mojo::DOM object. I'm sure the linked documentation tells you more about the usage.