Here is the code that will produce error:
#!/usr/bin/env perl
use strict
use warnings FATAL=>'all';
use ExtUtils::Installed;
my $instmod = ExtUtils::Installed->new();
foreach my $module ($instmod->modules())
{
my $version = $instmod->version($module) || "???";
print "$module -- $version\n";
}
Just dont use “;” in use strict
error:
syntax error at ListModules.pl line 3, near "use strict
use warnings "
Execution of ListModules.pl aborted due to compilation errors.
Perl Version info:
This is perl 5, version 12, subversion 4 (v5.12.4) built for x86_64-linux-gnu-thread-multi
In short, no. But it’s not quite that simple.
There is a difference between a syntax error and a human error. Your human error was to omit the
;at the end of line 2, but this resulted in a syntactical error on line 3. There is no way for your computer to know that you meant to write a;on line 2, and it would be counter-productive for it to try to guess.It’s only with the benefit of hindsight — you have the memory of your intentions — that you can see a differential between the error output and what you spot with your eyes.
In conclusion, the output is correct; it’s just reporting something subtly different from what you’re looking for… and what you are looking for is intractible. Learning to read error messages and translate them into the knowledge you need to spot the human error is an invaluable programmer’s skill, and it comes naturally with practice.