Full source of my file test123.pl:
Code:
#!/usr/bin/perl -w
# use strict;
use CGI qw(:standard);
use warnings FATAL => 'all';
use CGI::Carp qw(fatalsToBrowser);
print header;
our @markings;my $marking;
$body='
<body>
...
<!-- Start marking -->
<data1>
<!-- End marking -->
...
<!-- Start marking -->
<data2>
<!-- End marking -->
...
</body>
';
$marking=$body;
$marking =~ s/<\!--\s*Start\s+marking\s*-->(.*?)<\!--\s*End\s+marking\s*-->/buildMarkingsArray($1)/iegs;
print $markings[0];
sub buildMarkingsArray{
push(@markings, $_[0]);return "";
}
When not using the Strict module, the above prints:
like it should and as intended.
When using the Strict module, I get an error:
Code:
Software error:
Global symbol "$body" requires explicit package name at /cgi-bin/test123.pl line 9.
Global symbol "$body" requires explicit package name at /cgi-bin/test123.pl line 23.
Execution of cgi-bin/test123.pl aborted due to compilation errors.
My question is how do I revise the above code to work with the Strict module?
Bookmarks