if( @ARGV && $ARGV[0] eq "-child" ) { shift( @ARGV ); # child code here exit( 0 ); } # Am parent # ... system(1,$^X,$0,"-child",@ARGV); # run child # ...