package PACK; sub func { print "1\n"; } package main; $obj = bless {}, 'PACK'; $obj->func; $str = "$obj->func;1"; eval $str or print $@;