vs.vaidyanathan 18 Newbie Poster

I wasnt to fork from a parent and execute two perl codes simultaneously rot13.pl and pi.pl.I want to keep track of the pid's of both children. i am not aware how to do it within the system() cmd.
I have written the code below. But something tells me I'm being repetetive and round about.
Any help?

#!usr/bin/perl5
#child processes running trial
sub run_rot13{
($x,$y)=@_;
system(" perl $x.pl <$y &");
print("\n$$\n");
}
sub run_pi{
($x,$y)=@_;
system("perl $x.pl <$y &");
print("\n$$\n");
}
unless($pid=fork)
{
run_rot13(rot13,lista);
exit;
}
print("$$\n$pid\n");
unless($pid=fork)
{
run_pi(pi,no_trials);
exit;
}
print("$$\n$pid\n");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.