sub store_position { my( $t, $elt)= @_; my $line = $t->{twig_parser}->current_line; # $t->{twig_parser} is the expat object my $column = $t->{twig_parser}->current_column; $elt->{custom_atts}{position}= [$line, $column]; # crude but works }