use strict; package Subref; sub new { my $class = shift; my $ref = shift; bless($ref, $class); } sub myderef { my $self = shift; 1 while ($self = $self->(), UNIVERSAL::isa($self, 'CODE')); } use overload '<>' => \&myderef; package main; my $ms= Subref->new(sub { sub{print 'msqrx'}} ); <$ms>;
In reply to Re: Easier ways to write
by bikeNomad
in thread Easier ways to write
by InfiniteSilence
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |