#!/usr/bin/perl use strict; use warnings; my $x = main->new(); sub new { my $self = bless { }, shift; $self->{mouse_mode} = 2; } sub DESTROY { my $self = shift; if ($self->{mouse_mode} == 2) { print "foo\n"; } }