in reply to Re: Re: sorting a hash that's in another file
in thread sorting a hash that's in another file
But this assumes that you won't have a semi colon in the hash declaration in script.pl. There's a zillion ways to do the reading-in part, too, beyond just a smarter test for when you're done.open SCRIPT, "script.pl" or die "you scurvy dog"; while (<SCRIPT>) { # Find the declaration next unless /\%some_hash/; $hash_declaration = $_; # Now pop out and do another while loop last; } while (<SCRIPT>) { # Keep appending until we reach a semi-colon $hash_declaration .= $_; last if /;/; } eval($hash_declaration);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sorting a hash that's in another file
by cLive ;-) (Prior) on Jul 23, 2003 at 22:03 UTC |