#!/usr/bin/perl use strict; use B; use C; use Data::Dumper; $Data::Dumper::Indent = 1; my $foo = new C; $foo->id(123); $foo->name("thingy"); $foo->model("Z80"); my $bar = new B; $bar->id(456); $bar->city("Lhasa"); $bar->name("kouxuan"); print Dumper($foo); print Dumper($bar); __END__ $VAR1 = bless( { 'model' => 'Z80', 'name' => 'thingy', 'id' => 123 }, 'C' ); $VAR1 = bless( { 'city' => 'Lhasa', 'name' => 'kouxuan', 'id' => 456 }, 'B' );