in reply to Re: Readonly error on $_
in thread Readonly error on $_

Note that your second example doesn't test for an object but for an object or a package name and Perl considers most strings that don't contain control characters to be package names. This is easy to fix:

sub selfcontrol { my $self = shift; return $self if ref($self) && eval {$self->can("can")}; carp "diem"; }

        - tye (but my friends call me "Tye")