<?xml version="1.0" encoding="windows-1252"?>
<node id="1010084" title="Re^2: Checking value of an extracted variable" created="2012-12-23 05:13:15" updated="2012-12-23 05:13:15">
<type id="11">
note</type>
<author id="1010044">
r.biswas</author>
<data>
<field name="doctext">
&lt;p&gt;
My code is shown below. After locating the keyword(stored in $first) I need to check the value of the variable stored in $first. 
$first = SEL_BLOCK.  
But I need to check the value of the SEL_BLOCK.
How can it be done?
&lt;/p&gt;

&lt;code&gt;
open(OUT,"&gt;Output.txt") or die "Can't open output.txt for writing:$!\n";
open(IN, "&lt;Input.txt") or die "Can't open input.txt for reading:$!\n";


@array = &lt;IN&gt;;

foreach $line (@array) {
  chomp ($line);

  if ($line =~ /^OPT:/) {
    $var = $';
    @param = split / /, $var;
    $first = $param[1];
    print "$first\n";
	if ($first==1) { # This is not working as desired
        $start = 1;
    }
    else {
      $skip = 1;
    } 
  } 
  
  elsif ($start == 1 || $skip==1) {
    
    if ($line =~ /^]/) {
      $start = 0;
      $skip = 0;
    }
    elsif ($skip == 0) {
      printf (OUT "$line\n");
    }  

  }  
  else  {
    printf (OUT "$line\n");
 
  }

}
&lt;/code&gt;</field>
<field name="root_node">
1010077</field>
<field name="parent_node">
1010079</field>
</data>
</node>
