in reply to Re: Re: How can I deal with those big table data?
in thread How can I deal with those big table data?
You probably want something like this:
Note the fact that %MYHASH is assigned a whole bunch 'o data from the file, and after do_hash is completed (and %MYHASH has stuff in it) THEN all the data is printed out. And BTW, it should've probably been split, 2 not split, 1.#!/usr/bin/perl -w use strict; my ($file_list, $file_data)=@ARGV; my %MYHASH; #create hash sub do_hash { my $filename=shift; open(FH, $filename) or die "Can't open $filename: $!\n"; while(<FH>){ my ($Name, $Data)=split,2; $MYHASH{$Name} = $Data; } close FH; } do_hash('file_data'); foreach my $key (keys %MYHASH) { print "$key => $MYHASH{$key}\n"; } exit;
Gary Blackburn
Trained Killer
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: How can I deal with those big table data?
by Anonymous Monk on May 21, 2002 at 01:15 UTC |