in reply to Re: Creation of simultaneous system commands
in thread Creation of simultaneous system commands

For example:
foreach ( @your_jobs ) { if ( $pid ) { # parent ; # do nothing } elsif ( defined $pid ) { # child # do something with $_ here, and then exit: exit; } else { die "fork failure $!"; } }

I've just started learning about forking, but this seems to be the general way to do it.

update: oop, that should've been foreach instead of while

Replies are listed 'Best First'.
Re: Creation of simultaneous system commands
by Abigail-II (Bishop) on Feb 26, 2004 at 17:39 UTC
    And if your jobs are external programs to be run:
    fork // die || exec $_ for @jobs;

    If they are subs to be called:

    fork // die || exit &$_ for @jobs;

    Abigail