I have two scripts and two conf file (actually perl scripts too):
conf1.pl
@some_array = ({name =>"orange", deny = > "yes"},
{name =>"apple", deny = > "no"});
conf2.pl
@some_array = ({name =>"male", deny = > "yes"},
{name =>"female", deny = > "no"});
script.pl
#!/usr/bin/perl -w
use strict;
our %deny = ();
call_another_script.pl_somehow_with_param conf1.pl
call_another_script.pl_somehow_with_param conf2.pl
foreach my $key (%deny) {
print $deny{$key},"\n";
}
another_script.pl
#!/usr/bin/perl -w
my $conf_file = shift;
do $conf_file;
foreach my $item (@some_array) {
print $item->{name},"\n";
if (defined $deny) {
$deny{$item{name}}++ if $item{deny} eq "yes";
}
}
I would like to call another_script.pl with conf filenames from script.pl so %deny will be visible in another_script.pl. And I dont wanna use Perl modules and I want to have scripts in separate files. For example
./another_script.pl conf2.pl
and
./script