fernandes has asked for the wisdom of the Perl Monks concerning the following question:
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#!/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");
at the same execution.Job_selection("1"); Job_selection("2");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: My sub does not work twice
by GrandFather (Saint) on Aug 07, 2007 at 22:34 UTC | |
|
Re: My sub does not work twice
by wind (Priest) on Aug 07, 2007 at 22:25 UTC | |
|
Re: My sub does not work twice
by johnnywang (Priest) on Aug 07, 2007 at 22:31 UTC |