Dear monks,
I have a sub that reads a part p1 of a file and produces the expected output o1. When I change one variable in the code, it reads the part p2 and produces the expected output o2. Everything happens as expected. However, when I am trying to produce o1 and o2, in the same execution, it does not work. This
ad hoc quasi-code resumes:
#!/usr/bin/perl -w
use strict;
our $select_job;
our $filehandle_in;
our $filehandle_out;
sub Job_selection{
$select_job = shift;
open (our $filehandle_in, "<", "input.txt") || die "Can't read inp
+ut.txt: $!";
open (our $filehandle_out, ">", "output_$select_job.txt") || die "
+Can't write output_$select_job.txt: $!";
#
#job is done here
#
close $filehandle_in;
close $filehandle_out;
}
Job_selection("1");
Job_selection("2");
So, to be clear as fresh water: if I run this code changing for
#Job_selection("1"); Xor #Job_selection("2"); it works; but it does not work when I call both
Job_selection("1");
Job_selection("2");
at the same execution.
Best regards!