Use full computing power with Perl

I have a perl script that works correctly, but it uses only 1 core of my 2-core processor, how can I get it to use all the kernels.

I know that I can create threads using threads-> new (); but how do I fit this into something like:

my $twig= new XML::Twig::XPath(TwigRoots => {TrdCaptRpt => \&top_level});
$twig->parsefile($file);

where the subroutine is called by something else.

+3
source share
2 answers

The standard approach with Perl is to not try to use multiple cores with a single script call, but instead run jobs in parallel on separate cores.

, Perl, Perl-Threading () . , , Perl , . , , , .

+6

XML:: Twig. , . script , - script, . , script, 2 script (, xargs?).

+3

Source: https://habr.com/ru/post/1792570/


All Articles