develooper Front page | perl.perl5.porters | Postings from December 2009

Storable.pm

Thread Next
From:
Richard Thomas
Date:
December 9, 2009 03:15
Subject:
Storable.pm
Message ID:
3e732afd0912080148q78e5daf5y423f5b26bfc01beb@mail.gmail.com
Hi,

I hope someone can help me with this.

I'm trying to use Storable.pm and I am having difficulties with it.

Here is the script I am using to store a variable in a file:

use strict;
use warnings;
use Storable;
my $data='1234';
store(\$data,'test.dat');
printf("Stored %s\n",$data);


 Here is the script I am using to read the variable from the file:

use strict;
use warnings;
use Storable;
my $data;
$data=retrieve('test.dat');
printf("Retrieved %s\n",$data);

When I run the retrieval script, I get:

Retrieved SCALAR(0x1846d14)

But not the "1234" that I expected.

Please could someone let me kno where I am going wrong.

Thank you.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About