package Person; use XML::Parser; sub new { my $class = shift; my $id = shift; my $self = { id => $id }; bless $self; ## now, set up XML::Parser; $parser->parsefile ("/path/to/some/file/$id.xml"); return $self; } # standard XML::Parser stuff here sub startElement { my( $parseinst, $element, %attrs ) = @_; if ($element eq "TAG") { my $property = $attrs{Property}; ## HOW TO SET $self->{property} from here? } }