package Exception; sub TIESCALAR { bless {}, $_[0] } sub STORE { print "Changing the value from '$@' to '$_[1]' (not really)\n" } sub FETCH { print "$@\n";42 } package main; my $t = tie $@, 'Exception' or die "Unable to do what you want\n"; my ($foo, $bar) = (0, 0); $@ = "hi"; eval { $foo = 42 / $bar }; print "The value is : $@\n"; $t->STORE("taking a look"); print "Value is still: $@, though\n"; $@ = 'blah'; print "Now the value is : $@\n"; __END__ Changing the value from 'hi' to 'hi' (not really) The value is : Illegal division by zero at - line 10. Changing the value from 'Illegal division by zero at - line 10. ' to 'taking a look' (not really) Value is still: Illegal division by zero at - line 10. , though Changing the value from 'blah' to 'blah' (not really) blah Now the value is : 42