use 5.010; given ( fork ) { when ( undef ) { die "Can't fork: $!"; } when ( !$_ ) { # child } default { # parent my $child_pid = $_; } }