Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#Open the output file
my $outputfile="myhash";
unless( open(MYHASH, ">$outputfile")){
print "Can't open file \"$outputfile\" to write to!\n";
exit;}
#Create hash keys and values array
my %myhash=();
#I use mydnahash' values to be myhash's values
@myhash{@reg_data}=@mydnahash{@reg_data};
#Create hash
while(($k, $v)=each %myhash){
print MYHASH "$k=>$v, "};
I have to repeat it four times do the same thing, so I want to create a sub hash,how can I make this kind of sub? Thank you!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: create subroutine
by Popcorn Dave (Abbot) on May 04, 2002 at 21:37 UTC | |
|
Re: create subroutine
by Anonymous Monk on May 04, 2002 at 22:36 UTC |