in reply to printing a package result within quotes

Method calls will not normally be interpolated in a ""-string. You can use this:
my $d = data->new; print $d->Y, "\n"; # call $d->Y() in list context
or
my $d = data->new; print $d->Y()."\n"; # call $d->Y() in scalar context
or use the infernally ugly and difficult to remember:
my $d = data->new; print "@{[ $d->Y ]}\n"; # can't remember if this # is in scalar or list context :-)
-- Joost downtime n. The period during which a system is error-free and immune from user input.