in reply to trouble with substitution
Update: Silly me. I totally forgot about the do function!use Modern::Perl; my $data; my $VAR1; my %hash; { local $/; $data = <DATA>; } eval $data; %hash = %$VAR1; __DATA__ $VAR1 = { '' => '', '362520' => 'Fktn and Name: fukutin[Rattus norvegicus]', '375790' => 'AGRN and Name: agrin[Homo sapiens]', '3339' => 'HSPG2 and Name: heparan sulfate proteoglycan 2[Homo sap +iens]', '1428' => 'CRYM and Name: crystallin, mu[Homo sapiens]', }
use Modern::Perl; my %hash = %{do 'dumpparse.txt'}; say map {"$_ : $hash{$_}\n"} keys %hash;
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: trouble with substitution
by remiah (Hermit) on Jan 19, 2012 at 12:43 UTC | |
by CountZero (Bishop) on Jan 19, 2012 at 19:25 UTC |