title: How to read numbers from extracted lines (deleting repeated numbers)
body: <p>I need to convert parts of a .txt file in this format (first by matching "SchDay")</p>
  
  <pre><code>&lt;SchDay&gt;
    &lt;Name&gt;School Occup WD&lt;/Name&gt;
    &lt;Type&gt;Fraction&lt;/Type&gt;
    &lt;Hr index="0"&gt;0&lt;/Hr&gt;
    &lt;Hr index="1"&gt;0&lt;/Hr&gt;
    &lt;Hr index="2"&gt;0&lt;/Hr&gt;
    &lt;Hr index="3"&gt;0&lt;/Hr&gt;
    &lt;Hr index="4"&gt;0&lt;/Hr&gt;
    &lt;Hr index="5"&gt;0&lt;/Hr&gt;
    &lt;Hr index="6"&gt;0&lt;/Hr&gt;
    &lt;Hr index="7"&gt;0.05&lt;/Hr&gt;
    &lt;Hr index="8"&gt;0.75&lt;/Hr&gt;
    ....
  </code></pre>
  
  <p>to look like this (values come first, and “steps” need just the 2 ends defined):</p>
  
  <pre><code>0.00, 0.00,
  
  0.00, 6.00,    &lt;- end of step
  
  0.05, 7.00,
  
  0.75, 8.00,
  
  ...
  </code></pre>
  
  <p>Etc</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>open (OUTFILE, "&gt;C:/begperl/parts/all1.txt")|| die "Can't open it";
  
  my @files = glob ("*.txt");
  
  for (@files) {
  
      open (INFILE, $_) || die "can't open infile";
      @lines = &lt;INFILE&gt;;
      my %answer;
      $regex = '&lt;SchDay';
      for my $idx (0..$#lines) {
      if ($lines[$idx] =~ /$regex/) {
          for $ii (($idx + 3)..($idx + 26)){
          {$answer{$ii} = ($lines[$ii]);}
          }
      }
      foreach $key (sort keys %answer) { print OUTFILE "$answer{$key}\n" }
      }
  close (INFILE);}
  </code></pre>
  
  <p>So I have the lines I want. Now I need to extract just the numbers, including decimal points, and then delete consecutive hours with the same values.</p>