# in Script #1:
my $file = 'script1_final.txt'; # add path as required
open(my $fh, '>', $file) or die "Cannot open file '$file' for writing:
+ $!";
print $fh $final;
close $fh;
# in Script #2:
my $file = 'script1_final.txt'; # add path as required
open(my $fh, '<', $file) or die "Cannot open file '$file' for reading:
+ $!";
my $final = <$fh>;
close $fh;
unlink $file or warn "Cannot delete file '$file': $!";
# Use $final as needed...
The only coupling required here is that the name of the shared file must be known to both scripts.
Not saying this is the best solution, but it does have the virtues of simplicity and extensibility (since it is straightforward to add data to the file if additional data sharing between the scripts is required down the track).
HTH,
Athanasius <°(((>< contra mundum
|