in reply to Re: Can I do single-file, Object oriented perl?
in thread Can I do single-file, Object oriented perl?
bless(\$text, $class); is blessing a reference - and because bless returns the blessed value as well as acting directly upon it, the subroutine *does* return a blessed reference. See for example:
my $foo = "bar"; print bless \$foo, "Test";
Update: Apologies to jeffa, I got confused and was reading the wrong code when replying. The OP is indeed trying to bless a non-ref scalar, which would lead to an error: Can't bless non-reference value
/J\
|
|---|