#!/usr/bin/perl use Win32::Process; for (1..3) { eval { print "$_\n"; Win32::Process::Create(my $proc, $^X, "perl child.pl", 0, 0, "."); }; if ($@) { if (index($@, 'Custom Exception') == 0) { print "Caught exception: $@"; next; } else { die $@; } } }