#!/usr/bin/perl use strict; use warnings; sub f1 { die "vyjimka"; }; sub f2 { die "neco jineho"; }; for my $f (\(&f1, &f2)) { eval { $f->(); }; my $error = $@; if ($error ~~ /^vyjimka/) { print 'Chycena vyjimka: ', $@; } else { $@ = $error; die; } } print 'Konec programu';