Perl run other 2 scripts in parallel

Ok so I have 2 scripts, I would like to make another script that will run them at the same time. The scripts print some data and I would like to see in 1 window what they print. I am on windows running Activestate Perl v5.8.7. I heard it could be done with fork or something but I couldn't do it (i am really new to perl and i don't understand it too much).

Thank you!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fork - You could fork off a process in which you start another process.
Shell - you could put one process in the background and start the other one

Window1 - dont understand....if you mean to say that you want the output on different parts of the terminal, you should probably look into the curses library....
XBonzataAuthor Commented:
I mean i want the output on the same place, currently i'm running 2 scripts in 2 diffrent windows. I want to run those 2 scripts in 1 window.
XBonzataAuthor Commented:
Anyone can help me please?
OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

Why not just run them in a shell at the same time?

perl; perl

If you run them truly "at the same time" by menas of threads then their output has a chance of being garbled together.  Do you really want to run them simultanously or sequentially?
As manav said, you need to use fork to create a child process for the second script so it can run in parallel with the first script. However, Windows doesn't handle forking as well as a *nix system.  How do you want the output handled?  Do you want the output of one on the left side and the output of the other on the right side of the window, or just let the lines of output intermix?  If you want them seperated, then you might be able to use the Win32::Console module or one of the curses modules.

Another option would be to use a GUI such as Tk and put their output into seperate widgets.

or Wx
XBonzataAuthor Commented:
I want them to intermix, they send 1 line from like 1 minute to 1 minute and I allready put them to print which script the line comes from. I am new to perl and i allready seen the documentation for fork but it doesn't give any examples or anything. I need an example because i can't understand forking from that documentation...
#!/usr/bin/perl -w

use strict;

my $forkOne = fork();
die "Unable to complete fork one: ($!)\n" unless(defined($forkOne));
unless ($forkOne) {
   print "End of fork one!\n";
} else {

my $forkTwo = fork();
die "Unable to complete fork two: ($!)\n" unless(defined($forkTwo));
unless ($forkTwo) {
   print "End of fork two!\n";
} else {

sub procOne {
   print "Process one!\n";
   my $var1 = 5;
   $var1 += $var1 for (0..1000);
   print "Variable one is: $var1\n";

sub procTwo {
   print "Process two!\n";
   my $var2 = 5;
   $var2 += $var2 for (0..100);
   print "Variable two is: $var2\n";

Here is an example of the forking process.  However the two forking processes are still handled in turn and are not truly ran at the same time.  If you run this a few times you may see the order of printed statements may change depending on how fast the fork returns from the child process.  This is only seen on *nix based platforms since Windows does not properly handle the fork() function call and therefore can only emulate it.  On Windows you should see the same sequential order every time.

As I said if you truly want the two process executed at the exact same time then threads are what you need but fork may suffice.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
XBonzataAuthor Commented:
ZiaTioN your right about fork in Windows and thanks for the idea with threads, their very easy to make and work great :).
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.