|
|
| XP is just a number | |
| PerlMonks |
Re^3: Math::BigInt newby tobyink (Prior) |
| on Sep 27, 2012 at 16:13 UTC ( #996044=note: print w/ replies, xml ) | Need Help?? |
|
$class is the same as $x (i.e. the bigint 27) the whole way through new, and bless implicitly stringifies its second argument (like print implicitly stringifies its arguments). ref($x)->new(48) should do what you want. Another reasonably common idiom is:
This allows $existing to be either an existing object or a class name.
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||