http://qs1969.pair.com?node_id=33671

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi. Is it possibly in Perl to EXECUTE 2 PROGRAMS from ONE in that way, that the 2 programs were working at the same time - 2 PROCESSES ??? I made Perl program: system("c:\\valeriy\\program2\\pr1.pl"); system("c:\\valeriy\\program2\\pr2.pl"); But It executes FIRST, then WAITS, than executes 2ND. I need then working at the same time, paralelly. :) Hope here are Perl professionals.

Replies are listed 'Best First'.
(bbq) Re: 2 programs as 2 processes
by BBQ (Curate) on Sep 22, 2000 at 22:36 UTC
    use the fork, Luke...

    #!/home/bbq/bin/perl
    # Trust no1!

      Note that the originaly poster appears to be using a Microsoft "operating system" which means that fork probably isn't the best choice. This is because prior to Perl 5.6.0, fork() didn't work. With Perl 5.6.0, fork() might work for this but it is very new and appears to be quite buggy in some situations.

      Personally I'd use system(1,"script") to prevent the calling script from waiting.

              - tye (but my friends call me "Tye")
Re (tilly) 1: 2 programs as 2 processes
by tilly (Archbishop) on Sep 22, 2000 at 22:32 UTC
Re: 2 programs as 2 processes
by jreades (Friar) on Sep 22, 2000 at 22:30 UTC