N
Niall Macpherson
I have noticed some strange behaviour if I accidently miss out the line
terminating semi-colon after a use directive . Here is some sample code
(Active Perl 5.8.7)
use strict;
use warnings;
use Data:
umper;
my ($foo, $bar) = (2,3);
my $foobar = $foo + $bar;
print "\nfoo = [$foo], bar = [$bar], foobar = [$foobar]\n";
exit(0);
This produces the expected output
H:\Perl Scripts>semi_colon.pl
foo = [2], bar = [3], foobar = [5]
H:\Perl Scripts>
However if I remove the terminating semi-colon on line 3 - i.e
use Data:
umper
instead of getting a syntax error (as I would expect) , I get the
following
H:\Perl Scripts>semi_colon.pl
Data:
umper version 3 required--this is only version 2.121_04 at
C:/Perl/lib/Ex
porter/Heavy.pm line 121.
BEGIN failed--compilation aborted at H:\Perl Scripts\semi_colon.pl line
5.
H:\Perl Scripts>
Can someone please explain ?
Thanks
terminating semi-colon after a use directive . Here is some sample code
(Active Perl 5.8.7)
use strict;
use warnings;
use Data:
my ($foo, $bar) = (2,3);
my $foobar = $foo + $bar;
print "\nfoo = [$foo], bar = [$bar], foobar = [$foobar]\n";
exit(0);
This produces the expected output
H:\Perl Scripts>semi_colon.pl
foo = [2], bar = [3], foobar = [5]
H:\Perl Scripts>
However if I remove the terminating semi-colon on line 3 - i.e
use Data:
instead of getting a syntax error (as I would expect) , I get the
following
H:\Perl Scripts>semi_colon.pl
Data:
C:/Perl/lib/Ex
porter/Heavy.pm line 121.
BEGIN failed--compilation aborted at H:\Perl Scripts\semi_colon.pl line
5.
H:\Perl Scripts>
Can someone please explain ?
Thanks