Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Fun with implicit type conversions

by kikuchiyo (Friar)
on Aug 30, 2019 at 14:17 UTC ( #11105306=note: print w/replies, xml ) Need Help??


in reply to Fun with implicit type conversions

$orry, I couldn't resist.

#!/usr/bin/perl package Sorry; use overload '-' => sub { "@_\n" }, '!' => sub { __PACKAGE__->new("Perl Hacker"); }, '""' => sub { $_[0]->[0] }; sub new { bless [$_[1] // "Just Another"] } package main; my $orry = Sorry->new; print $orry - not $orry;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11105306]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2022-08-09 02:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?