Does someone know how to push data into an array as part of a fork process ??
I always get an empty array.
My code looks like this (I am using Parallel::ForkManager):
my $pid;
my $pm = new Parallel:ForkManager(5);
foreach my $element (@list){
$pid = $pm->start and next;
...
$result = ....
...
Hello,
I've got an input text in which I want to replace every string like "match(value)" by "value" (and store all "value" in an array)
i.e:
bla bla bla
bla bla match(value1) bla bla
bla match(value2) bla bla
bla match bla bla
bla match(value3) bla
becomes:
bla...
I am using Parallel::ForkManager to fork a subroutine used in a perl script. This subroutine uses an array (called @array).
My script get confused because (I reckon) of the name of the array is shared by all forked children.
So that, the content of @array might not be the one I expect to be...
I want to delete entries in a mysql table for which timestamp is older than 1 Hour. The mysql syntax is:
DELETE from table WHERE t < DATE_SUB(NOW(), INTERVAL 1 HOUR);
This works fine but I can't get it running through a perl DBI command. The following for instance does not work...
I've got a script that opens a log file and write into it.
I would like this file not to exceed a certain limit (500 lines for instances) i.e if I had line #501 line it's going to remove line #1 and so on...
Is there a nice way to achieve that ?
I've quoted below a basic script that reads a file and prints its content. Whatever the file is (/etc/hosts is just an example), the script adds a space for all the lines following line #1, i.e:
line 1
line 2
line 3
I would like it to return the file as it is, i.e:
line 1
line 2
line 3...
I've got a few perl scripts that use specific modules. I want to run them on many different systems that are not connected to the internet and I would like to save time and to make the installation of these modules easy for other users.
My idea is to create an installation script that will...
Hello,
Not sure if the category "helpful Tip" is rightly choosen.
Anyway, that might benefits to "less advanced" programmers like me.
A few days ago I posted a question related to a fork issue on perl 5.8. I have just found the problem.
The script I quoted was using fork...
Actually I have slightly modified this script like this:
- using Net::Ping (this should not make any difference)
- by pushing the result in an array within the last loop like this:
------------------------------------------
1 while wait_for_a_kid();
for (sort keys %host_result) {...
I've found a script on the web that uses fork to run several pings in parallel. It works fine on a Linux box running perl 5.00x but it does not work on RedHat 8 with perl 5.8. Is it due to the new multi threading architecture in 5.8 ?
Moreover, I've read on this forum that you can not push...
I am writing a project involving 10 to 20 perl scripts calling subroutines that I have organised in modules (.pm files). I have also one .pm file that contains all my global variables. I am not using packages because I don't feel the need for different namespaces here.
Is it the best and more...
In this case my regex would be sthg like:
$regex = "aaa bbb ddd|aaa ccc|aaa bbb eee|aaa bbb eee fff";
And I would like a line starting with "aaa ccc ..." to match the 2nd key not the the first one just because it starts with "aaa" because the action will differ...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.