in reply to Re: read a hash from a file
in thread read a hash from a file
The dump from my code is#!/usr/bin/perl use strict; use warnings; use File::Slurp; use Data::Dumper; $file="config.txt"; my %record =map{ s/#.*//; s/^\s+//; s/\s+$//; m/(.*?)\s*=\s*(.*)/; } read_file($file); print Dumper (\%record);
but when the data is in the code, the dump is$VAR1={ 'Name' =>John Smith', 'URL' => '15', 'RANK' => 'Tier 1', 'URL' => 'http://somesite.com' };
$VAR1= bless( { 'Name' =>John Smith', 'URL' => '15', 'RANK' => 'Tier 1', 'URL' => 'http://somesite.com' }, 'REC' );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: read a hash from a file
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 | |
by Anonymous Monk on Apr 16, 2013 at 07:20 UTC | |
by hdb (Monsignor) on Apr 16, 2013 at 07:29 UTC |