Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I call methods on Perl scalars?

I saw some code that called methods on scalars (numbers), something like:

print 42->is_odd

What do you have to overload so that you can achieve this sort of "functionality" in your code?

like image 845
Geo Avatar asked Dec 22 '22 07:12

Geo


1 Answers

Are you referring to autobox? See also Should I use autobox in Perl?.

like image 190
Ether Avatar answered Jan 04 '23 17:01

Ether