First I just want to say that I have been reading books, searching the net and experimenting for about 3 hours now......
the question is, Can I pass a hash to a package? I have been readin FAQ's like there is no tomorrow.. and most of it is over my head (using double dog secret vars and code that my books don't even talk about). I got the code to work in the program. but when I put the sub in the package it does not like passing the hash. A hint would be nice.. like I have to turn the hash into an array to pass it. and then work it as an array in the package then return the array to tthe program and then turn the array back into the hash.....I know I can pass arrays. or I could leave it as a sub in the program..... Lou ##code below##################### ## Clark, Randy! get your duct tape... here comes the code! ## I'll tell you now it realy is going to make your head spin! ## I warned you! #!/usr/bin/perl use strict; require 'ReadWriteParse.pl'; #<<package I'm trying to put the sub in. my (%Player,$FN,%Data,$Data,$key,$value); %Player = (Name =>"Luinrandir",Town =>"Avalon",Homeland =>"Ireland",); #this is where the call for the package goes############# %Data=%Player; # WriteHashFile("$Player{Name}$Player{Town}.pf"); # ############################################### open (READ, "$FN"); #flock (READ,LOCK_EX); while ($Data=<READ>) { ($key,$value)=split /=/,$Data; $Data{"$key"}="$value"; } close (READ); foreach (values(%Data)) { print ; print "\n"; } exit; sub WriteHashFile #<<<< this is the DIR I want to put in the package. { open (WRITE, ">$_[0]"); # flock (WRITE,LOCK_EX); while (($key,$value)=each(%Data)) { print WRITE "$key=$value\n"; } close (WRITE); } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>