my $nn1 = $c1->localname(); my $nn2 = $c2->localname(); print "\$nn1 $nn1\n\$nn2 $nn2\n\n"; Output: $nn1 Authors $nn2 Authors