note
soonix
<ul>
<li><c>
open (INFILE, "$ARGV[1]") or die "$ARGV[1] cannot be openned : $!";
while ($source_file =~ /(\d)\s+(\d)\s+(\d)\s+(\w+)/)
</c>
Maybe (probably) in your head there's a connection between <c>INFILE</c> and <c>$source_file</c>, but not in your script.<br> For Perl, they're unrelated…
</li><li><c>
if ($ARGV[0] eq "-a")
</c>
How do you know your <c>$ARGV[0]</c> really equals <c>"-a"</c>? <br> What happens if it doesn't? <br> I recommend to add an <c>else</c> block with a <c>print "whatever\n"</c>, at least while you're still experimenting.
</li><li>
Many of the suggestions to your questions include using [doc://strict] and [doc://warnings]. Although this seems to impede or slowing down one's development, I recommend it, too:
<ul>
<li>
Yes, the time it takes before your script "runs", will be longer
</li><li>
The time until your script works <i>correctly</i>, will be shorter
</li></ul>
One of strict's messages is confusing for beginners: <blockquote>Global symbol "$x" requires explicit package name</blockquote> should read <blockquote>Do you really want "$x" to be a global symbol? Better declare it with [doc://my]</blockquote>
</li></ul>
If you are new to Perl, you might like [doc://diagnostics], which won't throw more errors, but messages that (hopefully) are more informative.
So, your script(s) should start with <c>
use strict;
use warnings;
use diagnostics;</c>
11101345
11101386