jackyex has asked for the wisdom of the Perl Monks concerning the following question:
Hello... I want to make a perl script that will use ForkManager and have some v +ariables loop inside like this : 1. I have file x: jacky@ubuntu:~/Desktop$ cat x 1 2 3 4 5 ######################## 2. And I have file y: jacky@ubuntu:~/Desktop$ cat y jack john joe ######################## 3. I than have script.pl: jacky@ubuntu:~/Desktop$ cat script.pl: #!/usr/bin/perl use Parallel::ForkManager; use LWP::Simple; my $file = x; my $pm = new Parallel::ForkManager(3); open($fileh, "<" . $file); while (<$fileh>) { $pm->start and next; $linex = $_; $linex =~ s/\x0a//g; open OUTPUT,">$linex"; print OUTPUT ("$linex\n"); close OUTPUT; $pm->finish } close($fileh); $pm->wait_all_children(); ################################## Now I want inside the line "print OUTPUT ("$linex\n");" to do somethin +g like this "print OUTPUT ("$linex$liney\n");" and loop the content o +f "y" file inside every "$linex" file created...in the end I want the + $linex files with this content: cat 1 = 1jack cat 2 = 2john cat 3 = 3joe cat 4 = 1jack cat 5 = 2john Is that possible? Thank you and please excuse my bad english, Jack
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Variables loop in Parallel::ForkManager
by ikegami (Patriarch) on Nov 29, 2008 at 21:43 UTC | |
by jackyex (Initiate) on Nov 29, 2008 at 22:27 UTC | |
by ikegami (Patriarch) on Nov 29, 2008 at 23:50 UTC | |
by jackyex (Initiate) on Nov 30, 2008 at 08:22 UTC | |
by ig (Vicar) on Nov 30, 2008 at 09:29 UTC | |
by ikegami (Patriarch) on Nov 30, 2008 at 15:54 UTC |