...and a Perl subroutine is defined with
sub, but maybe your code is just a typo (looks like old ksh syntax).
Anyway, one possibility might be that in one place you put the string inside quotes (interpolation) and the class is overloading stringification (see
overload). You don't show that, but then again this obviously is not the whole code anyway.