title: problem with `glob` function in perl
body: <p>I want to get a list of all the files whose name looks like : <code>$res_dir/$line/$fub_name*.istf</code></p>
  
  <p>meaning: in directory <code>$dir</code> in sub directory <code>$line</code> a file that starts with <code>$name</code> and ends with <code>.istf</code>.</p>
  
  <p>each sub directory contains only 1 such file, but there are many sub directories. I've written this:</p>
  
  <pre><code>foreach $line (@arr){
      chomp ($line);
      $new_istf = glob ("$res_dir/$line/$fub_name*.istf");
      do something...
  </code></pre>
  
  <p>but it doesn't give me all the files, but only half of them. when I added the fallowing debug code:</p>
  
  <pre><code>if ($new_istf){
      print "\tdbug:: $res_dir/$line/$fub_name*.istf:\t'$new_istf'\n";
  } else {
      print "\tdbug:: $res_dir/$line/$fub_name*.istf:\t''\n";
  }
  </code></pre>
  
  <p>and the resulting output was:</p>
  
  <pre><code>    dbug:: RESULTS//791202_0_SA0/ieuni5cts*.istf:   'RESULTS//791202_0_SA0/ieuni5cts.mlc.xxx.x.istf'
      dbug:: RESULTS//791212_0_SA0/ieuni5cts*.istf:   ''
      dbug:: RESULTS//791241_0_SA0/ieuni5cts*.istf:   'RESULTS//791241_0_SA0/ieuni5cts.mlc.xxx.x.istf'
      dbug:: RESULTS//791248_0_SA0/ieuni5cts*.istf:   ''
      dbug:: RESULTS//791251_0_SA0/ieuni5cts*.istf:   'RESULTS//791251_0_SA0/ieuni5cts.mlc.xxx.x.istf'
      dbug:: RESULTS//791258_0_SA0/ieuni5cts*.istf:   ''
      dbug:: RESULTS//791272_0_SA0/ieuni5cts*.istf:   'RESULTS//791272_0_SA0/ieuni5cts.mlc.xxx.x.istf'
      dbug:: RESULTS//791273_0_SA1/ieuni5cts*.istf:   ''
      dbug:: RESULTS//791301_0_SA0/ieuni5cts*.istf:   'RESULTS//791301_0_SA0/ieuni5cts.mlc.xxx.x.istf'
      dbug:: RESULTS//791333_0_SA0/ieuni5cts*.istf:   ''
      dbug:: RESULTS//791349_0_SA0/ieuni5cts*.istf:   'RESULTS//791349_0_SA0/ieuni5cts.mlc.xxx.x.istf'
      dbug:: RESULTS//791357_0_SA0/ieuni5cts*.istf:   ''
      dbug:: RESULTS//791405_0_SA1/ieuni5cts*.istf:   'RESULTS//791405_0_SA1/ieuni5cts.mlc.xxx.x.istf'
      dbug:: RESULTS//791432_0_SA0/ieuni5cts*.istf:   ''
      dbug:: RESULTS//791434_0_SA0/ieuni5cts*.istf:   'RESULTS//791434_0_SA0/ieuni5cts.mlc.xxx.x.istf'
      dbug:: RESULTS//791459_0_SA0/ieuni5cts*.istf:   ''
      dbug:: RESULTS//791462_0_SA0/ieuni5cts*.istf:   'RESULTS//791462_0_SA0/ieuni5cts.mlc.xxx.x.istf'
      dbug:: RESULTS//791463_0_SA0/ieuni5cts*.istf:   ''
      dbug:: RESULTS//791467_0_SA0/ieuni5cts*.istf:   'RESULTS//791467_0_SA0/ieuni5cts.mlc.xxx.x.istf'
      dbug:: RESULTS//791471_0_SA1/ieuni5cts*.istf:   ''
  </code></pre>
  
  <p>but all those files exist. since <code>glob</code> suppose to work like the sell interpreter, i've checked it and when I do <code>echo RESULTS//791463_0_SA0/ieuni5cts*.istf</code> (and every other file that was not detected by <code>glob</code>, it gives the right file name.</p>
  
  <p>I've also tried to run glob as a one liner with the paths that didn't give result, and it worked:</p>
  
  <pre><code>perl -e 'print glob("RESULTS//791467_0_SA0/ieuni5cts*.istf"),"\n"'
  </code></pre>
  
  <p>and it gave the right result as well</p>
  
  <p>Where is the problem in my code?</p>