Note that there are some explanatory texts on larger screens.

plurals
  1. POGlob is different value error opening a file and reading
    text
    copied!<pre><code>sub open_files { my @files = @_; my @lines; foreach (@files){ print "$_\[1\]\n"; } foreach my $f (@files){ print "$f\[2\]\n"; open(my $fh,'&lt;',$f) or die " '$f' $!"; print "$fh\[3\]\n"; push(@lines,&lt;$fh&gt;); close($fh); } return @lines; } </code></pre> <p>Hi i am having problems with opening files whose absolute path are stored in an array.</p> <p>What i want to do is go through the array and open each file and then store their data inside <code>@lines</code> array and then close the file handle.</p> <p>However i am able to open the <code>.html</code> files which are stored in the first child directory <code>.e.g /a/abc.html or /b/bcd.html</code> however it is not opening (or parsing ) the files which are in sub-child directories such as <code>/a/aa/abc.html or /b/bb/bcd.html</code></p> <p>I have put in some extra <code>print statements</code> in my script and numbered their output for the different print lines e.g. <code>[1] [2] [3]</code>.</p> <p>This is the result of executing the above code:</p> <p>The full code is : <a href="http://pastebin.com/DFsU1RUZ" rel="nofollow">pastebin Full code</a></p> <pre><code>/mnt/hgfs/PERL/assignment/test/a/aa/1 - Copy - Copy (2).htm[1] /mnt/hgfs/PERL/assignment/test/a/aa/1 - Copy - Copy (2).htm[2] GLOB(0x898ad20)[3] /mnt/hgfs/PERL/assignment/test/b/bb/1 - Copy - Copy (2).htm[1] /mnt/hgfs/PERL/assignment/test/b/bb/1 - Copy - Copy (2).htm[2] GLOB(0x898ae40)[3] /mnt/hgfs/PERL/assignment/test/a/1 - Copy - Copy (2).htm[1] /mnt/hgfs/PERL/assignment/test/b/1 - Copy - Copy (2).htm[1] /mnt/hgfs/PERL/assignment/test/c/1 - Copy - Copy (2).htm[1] /mnt/hgfs/PERL/assignment/test/a/1 - Copy - Copy (2).htm[2] GLOB(0x898ae40)[3] /mnt/hgfs/PERL/assignment/test/b/1 - Copy - Copy (2).htm[2] GLOB(0x898ae40)[3] /mnt/hgfs/PERL/assignment/test/c/1 - Copy - Copy (2).htm[2] GLOB(0x898ae40)[3] </code></pre> <p>If you guys need the full code here it is : <a href="http://pastebin.com/DFsU1RUZ" rel="nofollow">pastebin Full code</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload