use strict; use warnings; use Data::Dumper; open SCRIPT, "script.pl" or die "Can't open file: $!"; our $hash_declaration=''; our %some_hash; 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 .= $_; eval $hash_declaration; last unless $@; } close(SCRIPT); print Data::Dumper->Dumper(\%some_hash);
.02
cLive ;-)
In reply to Re: sorting a hash that's in another file
by cLive ;-)
in thread sorting a hash that's in another file
by alienhuman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |