assuming you are alright with storing them in a hash as key value pairs,
something like this will probably work for you:

open I, "$ARGV[0]" or die $!;

my %conf;

while(<I>){
 chomp;
 next unless $_;
 my ($key,$val) = split /\s*=\s*/;
 $conf{$key} = $val;
}

for (keys %conf) { print "$_ = $conf{$_}\n" }


or this, whatever you prefer:

open I, "$ARGV[0]" or die $!;

my %conf;

{ local $/; %conf = map{ chomp; $_ ? split /\s*=\s*/ :
undef }split/\n/,<I> }

for (keys %conf) { print "$_ = $conf{$_}\n" }

###################

both untested for speed, but if it's a small file it really shouldnt matter

hope this helps

Jos Boumans

> I'm planning on starting my perl script with a commandline argument, a
> filename. I open the file and parse through it line by line, OK, but I'm
> getting a blank on how to grab the value out of the file for a variable in
> the script. The file will read like:
> -TestClass = 3
> -TestCase = all
> -Proxy_IP = 255.255.255.255
> -Proxy_Port = 8080
> -Url = 101.101.101.10:80/test.html
>
> I'll have variable for each item above and I just want to fill-in the
> values.
>
> Is there a way to pull out those values and assign them properly?


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to