954,523 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

passing arguments to subroutines

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");
vs.vaidyanathan
Newbie Poster
23 posts since May 2009
Reputation Points: 28
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: