#!/usr/bin/perl use strict; use warnings; use constant AWHILE => 1; my $life = new Life; until ($@) { eval { !$life->fulfilled ? sleep(AWHILE) && $life->tick : die('happy') } } print $life->fullfilled if $@ =~ /happy/; #_____________________________________________________________________ package Life; sub new { my ($existance, $self) = (shift,{age=>0, maxage=>int(rand(100))}); bless $self, $existance; } sub fulfilled { $ENV{ENLIGHTENMENT} } sub tick { no warnings 'once'; seek ENLIGHTENMENT, 0, 1; $_[0]->{age}++; die( $_[0]->{age} ) if (($_[0]->{age}) > ($_[0]->{maxage})) }