[Israel.pm] how to read a file to a Hash?

HeziGolan ketem95 at 013.net.il
Thu Jul 8 10:17:30 PDT 2004


#!/usr/bin/perl
use Data::Dumper;

my $hash = {
                "family" => {
                        "husband" => {
                                "x1" => 'y1',
                                "x2" => 'y2',
                        } ,
                        "wife" => {
                                "x3" => 'y3',
                                "x4" => 'y4',
                        } ,

				}
};
#write file
open (SAVE,">C:\\temp\\foo.file") || die '';
print SAVE Dumper($hash);
close SAVE;

#read file
do "C:\\temp\\foo.file";#load the Dumper file to memory
print Dumper $VAR1;




-----Original Message-----
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On
Behalf Of ליאת
Sent: Thursday, July 08, 2004 5:43 PM
To: perl at perl.org.il
Subject: [Israel.pm] how to read a file to a Hash?


hellow,
i need help plz.
i'm working on a client-server project.
i need to read data from a File to the socket (on the server side)  that
need to be read to hash variable (on the client side) my problem is how
to save the data in the file? how to organized it? for example:

my $hash = {
                "family" => {
                        "husband" => {
                                "x1" => 'y1',
                                "x2" => 'y2',
                        } ,
                        "wife" => {
                                "x3" => 'y3',
                                "x4" => 'y4',
                        } ,

                                         {
                  {

to save this data in a file that supposed to get the client in a hash
variable looks like that.


thanks
בתודה מראש
liat


_______________________________________________
Perl mailing list
Perl at perl.org.il
http://perl.org.il/mailman/listinfo/perl





More information about the Perl mailing list