I
IanW
Hi
How do I pass a hash to another script via the command line?
That is, if I do this
use strict;
my %data = (
field1 => 'f1val',
field2 => 'f2val'
);
my $result = `perl z:/interface.pl \%data`;
and in interface.pl I have the lines:
use strict;
my($dataref) = $ARGV[0];
print $dataref->{'field1'};
I get the error:
Can't use string ("%data") as a HASH ref while "strict refs" in use at
z:/interface.pl line ..
and if I comment out "use strict" then I get nothing.
What am I doing wrong?
Thanks
Ian
How do I pass a hash to another script via the command line?
That is, if I do this
use strict;
my %data = (
field1 => 'f1val',
field2 => 'f2val'
);
my $result = `perl z:/interface.pl \%data`;
and in interface.pl I have the lines:
use strict;
my($dataref) = $ARGV[0];
print $dataref->{'field1'};
I get the error:
Can't use string ("%data") as a HASH ref while "strict refs" in use at
z:/interface.pl line ..
and if I comment out "use strict" then I get nothing.
What am I doing wrong?
Thanks
Ian