in reply to syntax question

but the $x is NOT declared anywhere in the package. and i don't understand what a reference of the my keyword does?

$x is declared there where it's used. \my ($x) is short for something like (my $x; \$x;)

So it returns a reference to $x, not to my.

Perl 6 - links to (nearly) everything that is Perl 6.