|
Posted by Ben Morrow on March 6, 2008, 10:27 am
Please log in for more thread options
>
> Frank, Thanks a lot for your response. Indeed, @arr is not known beforehand
> and the content of @arr is generated by another perlscript. How would you
> recommend to bridge these 2 perlscripts?
Do they need to be separate scripts? Are they run at different times? If
you are using separate scripts simply as a way of putting the code in
separate files, you may want to use modules instead.
The easy and straightforward way to pass data from Perl to Perl is the
use the Storable module, which is core as of 5.8. In the first script
you say
use Storable qw/store/;
store \@arr, 'file' or die "store failed";
and then in the second
use Storable qw/retrieve/;
my $aref = retrieve 'file' or die "retrieve failed";
If you want the data to be human-readable, or readable from another
language, you could use YAML instead.
Ben
|