http://www.perlmonks.org?node_id=1005856


in reply to Re: Perl allows package names consisting entirely of colons
in thread Perl allows package names consisting entirely of colons

In terms of the package keyword itself, :: and main are distinct packages, and :::: is another package entirely...

$ perl -Mstrict -Mwarnings -E'package main; say __PACKAGE__' main $ perl -Mstrict -Mwarnings -E'package ::main; say __PACKAGE__' main $ perl -Mstrict -Mwarnings -E'package ::; say __PACKAGE__' :: $ perl -Mstrict -Mwarnings -E'package ::::; say __PACKAGE__' ::::
{ package main; sub xxx { 0 }; package ::; sub xxx { 1 }; package ::::; sub xxx { 2 }; } use 5.010; say ::xxx(); # 0 say ::::xxx(); # 1 say ::::::xxx(); # 2
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'