package compute; use strict; use warnings; use MCE::Shared; use base 'Exporter'; our @EXPORT_OK = qw/process $progress/; our $progress = MCE::Shared->scalar( 0 ); my @ARGV = @_; # I know this is dirty but that helps reducing the amount of modifications in compute.pl that uses @ARGV a lot sub process { open INPUT, '<', "@ARGV[9]" or die $!; #here I open the input file open OUTPUT, '>', "@ARGV[10]" or die $!; #here I open the output file STDIN->fdopen( \*INPUT, 'r' ) or die $!; #here I set the input file STDOUT->fdopen( \*OUTPUT, 'w' ) or die $!; #here I set the output file ...do all sort of computation... $progress->set("value_I_need"); } 1; } #### use MCE::Shared; use compute qw/ process $progress /; sub my_loop_updating_the_progress { my $point_of_progress = $compute::progress->get(); ...do whatever I want with $point_of_progress... } sub launch computation { @arguments_needed = ( arg1, arg2, arg3, arg4 ... arg9, arg10); compute::process(@arguments_needed); }