if (ref $automobile eq "car") { set x = y; } else (ref $automobile eq "truck") { set x = z; } #changed to use constant Y => "STRING1"; # In Base class use constant Y => "STRING2"; # In Derived Class #In Baseclass I'll have, set x = Y;