Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need to break your code into manageable steps.</p> <ol> <li><p>Create data-structures from the files </p> <pre><code>use Slurp; my @input = map{ [ split /\s+/, $_, 2 ] } slurp $input_filename; # etc </code></pre></li> <li><p>Process each element of <code>input_22.txt</code>, using those data structures.</p></li> </ol> <p>I really think you should look into <a href="http://www.perlmol.org" rel="nofollow">PerlMol</a>. After all, half the reason to use Perl is <a href="http://cpan.org" rel="nofollow">CPAN</a>.</p> <hr> <p>Things you did well</p> <ul> <li>Using 3-arg <a href="http://perldoc.perl.org/functions/open.html" rel="nofollow"><code>open</code></a></li> <li><code>use strict;</code></li> <li><code>use warnings;</code></li> </ul> <p>Things you shouldn't have done</p> <ul> <li>(Re)defined <code>$a</code> and <code>$b</code><br> They are already defined for you.</li> <li>Reimplemented <a href="http://p3rl.org/Slurp" rel="nofollow"><code>slurp</code></a> (poorly)</li> <li>Read the same file in multiple times.<br> You opened <code>SD_2.txt</code> once for every line of <code>input_22.txt</code>.</li> <li>Defined symbols outside of the scope where you use them.<br> <code>$j</code>, <code>$k</code>, <code>@array</code> and <code>@array1</code> are defined twice, but only one of the definitions is being used.</li> <li>Used <a href="http://perldoc.perl.org/functions/open.html" rel="nofollow"><code>open</code></a> and <a href="http://perldoc.perl.org/functions/close.html" rel="nofollow"><code>close</code></a> without some sort of error checking.<br> Either <code>open ... or die;</code> or <code>use autodie;</code></li> <li>You used bareword filehandles. <code>IN</code>, <code>FILE</code> etc<br> Instead use <code>open my $FH, ...</code></li> </ul> <p>Most of those aren't that big of a deal though, for a one-off program.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

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