in reply to Re: regex issue
in thread regex issue
use strict; # always # The hash that we'll populate my %value_of; # You have to open the file and read it... my $file = "your file name"; open(FILE, "<", $file) or die "Cannot read '$file': $!"; my $last_variable; while (<FILE>) { # Remove the newline chomp; if (s/^\s+//) { # This was indented, assign it to the hash $value_of{$last_variable} = $_; } else { # This was not indented, it was a variable name $last_variable = $_; } } # %value_of now has the data.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: regex issue
by Roy Johnson (Monsignor) on Mar 24, 2004 at 17:13 UTC | |
by tilly (Archbishop) on Mar 24, 2004 at 19:57 UTC | |
by Roy Johnson (Monsignor) on Mar 24, 2004 at 21:29 UTC |