in reply to greping inside a file
Then, just access like this:my %hash; my $profile; my $grade; my $key; my $value; open INPUT, "<input.doc or die "Couldn't open!"; LINE: while (<INPUT>) { if (/profile (\w+)/) { my $grade = $1; next LINE; } elseif ($_ eq 'END') { $hash{$grade} = $profile; undef $grade, $profile; } ($key,$value) = split; $$profile{$key} = $value; } close INPUT;
$hash{THIRDGRADE}{location} etc.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: greping inside a file
by Anonymous Monk on Jan 19, 2004 at 21:55 UTC |