use strict;
use Data::LinkedList;
my $list = Data::LinkedList->new();
$list->add({ name => 'Lloyd', age => undef });
$list->add({ name => 'Gary', age => undef });
CORE::say $list->get_first()->{name}; # Lloyd
CORE::say $list->get_last()->{name}; # Gary
$list->add_first({ name => 'Lisa', age => undef });
$list->add_last({ name => 'Bob', age => undef });
my $lisa = $list->remove_first(); # HashRef stored in $lisa
my $bob = $list->remove_last(); # HashRef stored in $bob
$list->offer_last($lisa);
CORE::say $list->remove_first_occurrence($lisa); # 1 (true)
CORE::say $list->size(); # 2
$list->add_all_at(1, ($lisa, $bob));
CORE::say $_->{name} for $list->to_array(); # Lloyd, Lisa, Bob, Gary
$list->set(1, "simple element");
CORE::say $list->get(1); # "simple element"
$list->write_object("list.txt");