in reply to Re: Config file default options?
in thread Config file default options?
I could not understand the following syntax, Just give me some hints about it.sub subject { 'Subject: default subject'; } sub to { 'To: default_to@example.com'; } sub from { 'From: default_from@example.com'; }
my %config = ( to => { regex => '^To:\s', sub => \&to }, from => { regex => '^From:\s', sub => \&from }, subject => { regex => '^Subject:\s', sub => \&subject }, ); my %cnf; # Load user data open DATA,'sss.txt' or die $!; foreach (<DATA>) { chomp; foreach my $c (keys %config) { if (/$config{$c}{regex}/) { $cnf{$c} = $_; last; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Config file default options?
by davorg (Chancellor) on Sep 08, 2006 at 08:37 UTC | |
by sanjay nayak (Sexton) on Sep 08, 2006 at 09:08 UTC | |
by davorg (Chancellor) on Sep 08, 2006 at 09:42 UTC | |
by sanjay nayak (Sexton) on Sep 08, 2006 at 12:20 UTC |