[Southampton-pm] A case for custom infix operators

James Raspass jraspass at gmail.com
Fri Mar 21 13:12:22 PDT 2014


Inspired by this in Python - http://legacy.python.org/dev/peps/pep-0238

I wanted to see how easily an integer dividing operator could be added to
Perl.

This implementation is a bit of a hack. I'm sure Tim'll appreciate the
blessed scalar ref :P

What do people think? It would be nice to have first class support for
custom operators in Perl, there has been some discussion on P5P but it
never went anywhere -
http://www.nntp.perl.org/group/perl.perl5.porters/2013/08/msg205547.html

[jraspass at gibson ~]$ ./div.pl
3.33333333333333
3
3.33333333333333
3
3.33333333333333
3
3.33333333333333
3

PS we should really get an IRC channel :)

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/southampton-pm/attachments/20140321/7760d82b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: div.pl
Type: application/octet-stream
Size: 208 bytes
Desc: not available
URL: <http://mail.pm.org/pipermail/southampton-pm/attachments/20140321/7760d82b/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Div.pm
Type: application/x-perl
Size: 334 bytes
Desc: not available
URL: <http://mail.pm.org/pipermail/southampton-pm/attachments/20140321/7760d82b/attachment.bin>


More information about the Southampton-pm mailing list