I've a file, which has entries like the following ...
IDENTIFIER1=value1;
IDENTIFIER2=value2;
IDENTIFIER3=value3;
etc
I've got to parse the above file and am using a hash to do the same ...
Here is my code ...
while (<>) {
chomp;
next if /^#/;
next if /^$/;
%CONF = split /=/;
}
But %CONF contains only the last key/value pair :-/
So I had to modify the above script to
while (<>) {
chomp;
next if /^#/;
next if /^$/;
$ref = [ split /=/ ];
$CONF{$ref->[0]} = $ref->[1];
}
The above is working fine.
So my question is why isn't the first code working?
I don't want to use too many variables in my script,
even with my second script I needed an extra variable viz $ref.
Is it possible to get the job done using the first script?
--
/binish/
|
- Need an explanation Binish A R
-