How do you use MCE (Many-Core Engine) with a short example?

MCE (Many-Core Engine) is a parallel processing module for Perl that simplifies the task of managing parallel execution in Perl scripts.
MCE, parallel processing, Perl, many-core engine, concurrency

# Example of using MCE for parallel processing in Perl

use strict;
use warnings;
use MCE::Shared;

# Initialize MCE
my $mce = MCE->new(
    max_workers => 4,
);

# Data to process
my @data = (1..10);

# Parallel processing using MCE
$mce->run(sub {
    my ($chunk_ref) = @_;
    foreach my $num (@$chunk_ref) {
        my $result = $num * $num;  # Square the numbers
        print "Square of $num is $result\n";
    }
}, \@data);
    

MCE parallel processing Perl many-core engine concurrency