Jasper has a module named RegionsData
, which stores
some geographic data.
He needs to filter the regions according to some rule:
Alas! There is no warnings during execution, but the result list is empty. Why?
The source code is downloadable: RegionsData.pm, islands.pl.
The hash %REGIONS
definetely contains required records: Lorbanery, Roke.
Well, %RegionsData::REGIONS
contains them.
The program uses the name %RegionData::REGIONS
,
although it should be %RegionsData::REGIONS
.
Symbol table RegionData::
(just as any other)
is avalable regardless of whether the corresponding package
is loaded.
And since the program uses the wrong name twice,
perl doesn’t produce a warning Name used only once: possible typo
.
So, use strict
and use warnings
are strong,
but even with them perl is much more tolerant to ‘unknown’ identifiers
than languages with static typing.
So keep an eye on your identifiers.