Satheesh Ramakrishnan wrote:
>
> All,
>
> How do I assign 1298b to some scalar variable from the string below.
>
> context_config_file = "1298b";
this is probably a cookbook, but....
##################################################################
require 5; # for (.*?) regex goodness
my (%cfg, $key, $val,
);
open(CFG, $config_file) || die "$0: can't open [$config_file]!\n$!\n";
while(<CFG>) {
chomp;
# split on whitespace(or not) and the '=' token
($key, $val) = split(/(\s*?)\=(\s*?)/);
$cfg{$key} = $val;
}
##################################################################
This should probably do it for you, leaving the configuration data in a
handy hash.
Cheers,
- Matt
- regular expression chris robinson
- Re: regular expression Chas Owens
- Re: regular expression chris robinson
- Re: regular expression Chas Owens
- Regular Expression Satheesh Ramakrishnan
- Re: Regular Expression Jeff Pinyan
- Re: Regular Expression rob chanter
- Re: Regular Expression ISO-8859-1
- RE:regular expression Mathew Hennessy
- RE:regular expression Jorge Goncalvez
- RE: regular expression Jeff 'japhy/Marillion' Pinyan
- regular expression Messervy, Joe M
- Re: regular expression Jeff 'japhy/Marillion' Pinyan
- Regular Expression Lilian Alvarenga Caravela Godoy
- Re: Regular Expression John W. Krahn
- RE: Regular Expression John Edwards
- RE: Regular Expression Mark Anderson
- regular expression LADDO
