output:#!/usr/bin/perl use strict; use warnings; use Data::Dumper; $Data::Dumper::Indent = 1; my %services = ( 1 => { name => "service1", host => { host1 => 1 }, }, 2 => { name => "dxuldm", host => { host0 => 2, host5 => 2 }, }, ); open my $fh, '>', 'services.txt' or die "can't open to write: $!\n"; print $fh Data::Dumper->Dump([\%services], [qw(services_restored)]); close $fh; our $services_restored; eval {do 'services.txt'}; print Dumper $services_restored;
$VAR1 = { '1' => { 'name' => 'service1', 'host' => { 'host1' => 1 } }, '2' => { 'name' => 'dxuldm', 'host' => { 'host0' => 2, 'host5' => 2 } } };
In reply to Re: Reading from a flat text file database and storing contents in a hash
by wfsp
in thread Reading from a flat text file database and storing contents in a hash
by wishartz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |