Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
This is the config file I want to move it to:my $record = REC->new( NAME => 'John Smith', AGE => '15', RANK => 'Tier 1', URL => 'http://somesite.com', );
And the snippet of code I've current mangled together:NAME=John Smith AGE=15 RANK=Tier 1 URL=http://somesite.com )
However using Data::Dumper I find that the structures are different, with the REC variable missing from my attempt. Can some kind monk enlighten me as to what I'm doing wrong in the code?my record =map{ s/#.*//; s/^\s+//; s/\s+$//; m/(.*?)\s*=\s*(.*)/; } read_file($file);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: read a hash from a file
by hdb (Monsignor) on Apr 16, 2013 at 06:23 UTC | |
by Anonymous Monk on Apr 16, 2013 at 06:46 UTC | |
by hdb (Monsignor) on Apr 16, 2013 at 06:51 UTC | |
by Anonymous Monk on Apr 16, 2013 at 06:59 UTC | |
by hdb (Monsignor) on Apr 16, 2013 at 07:08 UTC | |
| |
|
Re: read a hash from a file
by kcott (Archbishop) on Apr 16, 2013 at 10:11 UTC | |
|
Re: read a hash from a file
by BillKSmith (Monsignor) on Apr 16, 2013 at 12:51 UTC |