Hello,
The substitution s/ //g will effectively reset the reference variables $1
$2, .... So, moving the line ($value = $2) up eleminates the problem.
if ( $_ =~ /\{(.*)\}\s+(.*)/ ) {
$dev = 1;
$opt = lc($1);
$value = $2;
$opt =~ s/ //g;
}
Hope this helps,,,
Aziz,,,
In article <[EMAIL PROTECTED]>, "Hamish Whittal"
<[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I have the following lines from a config file I am trying to read:
> {wellfleet ASN} .1.3.6.1.4.1.18.3
> (agentType) .1.3.6.1.4.1.18.3.3.1.11 (chassisType)
> .1.3.6.1.4.1.18.3.1.1.1
>
> My code is:
> if ( $_ =~ /\{(.*)\}\s+(.*)/ ) {
> $dev = 1;
> $opt = lc($1);
> $opt =~ s/ //g;
> $value = $2;
> } elsif ( $_ =~ /\s*\((.*)\)\s+(.*)/ ) {
> $oid = 1;
> $opt = lc($1);
> $opt =~ s/ //g;
> $value = $2; #the OID of for this device
> } else {
> die ("Config file is badly built"); }
>
> The $1 works fine in the 1st if, but $2 will not return the .1.3.6.....
> Instead it return an empty string. Any clues.
>
> Thanks in advance.
> H
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]