use strict; use warnings; wants_foo_object({}); sub wants_foo_object { die "no object" unless defined(my $obj = shift); die "not an object" unless ref($obj); die "not a foo" unless $obj->isa('foo'); #the error I want } #The error I get: #C:\thomasdata\experiments>perl unblessedWantBetterError.t #Can't call method "isa" on unblessed reference at unblessedWantBetterError.t lin #e 10.