T
Tintin
Hi Folks,
I am hoping I am wrong here but is this a bug with reference to the
code segment below?
================================================
#!/usr/local/bin/perl
use strict;
use warnings;
$a=10;
print $a++ . "\n";
print $a . "\n";
================================================
After compilation and execution ==>
10
11
================================================
Perl version information is as below:
perl -v
This is perl, v5.8.8 built for darwin-thread-multi-2level
(with 10 registered patches, see perl -V for more detail)
Copyright 1987-2007, Larry Wall
Binary build 822 [280952] provided by ActiveState http://www.ActiveState.com
Built Jul 31 2007 19:44:51
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source
kit.
Complete documentation for Perl, including FAQ lists, should be found
on
this system using "man perl" or "perldoc perl". If you have access to
the
Internet, point your browser at http://www.perl.org/, the Perl Home
Page.
$
================================================
The same code is now modified as below:
#!/usr/local/bin/perl
use strict;
use warnings;
$some_var=10;
print $some_var++ . "\n";
print $some_var . "\n";
================================================
After compilation and execution ==>
10
11
================================================
Global symbol "$some_var" requires explicit package name
Global symbol "$some_var" requires explicit package name
Global symbol "$some_var" requires explicit package name
Execution aborted due to compilation errors.
================================================
I don't see why this code snipped should've executed in the first
instance. I have observed this behavior to be exhibited for the
following single character identifiers ($a, $b) that act as scalar
variable names.
Has anybody has had this experience before? Any thoughts?
Regards,
- Tintin
I am hoping I am wrong here but is this a bug with reference to the
code segment below?
================================================
#!/usr/local/bin/perl
use strict;
use warnings;
$a=10;
print $a++ . "\n";
print $a . "\n";
================================================
After compilation and execution ==>
10
11
================================================
Perl version information is as below:
perl -v
This is perl, v5.8.8 built for darwin-thread-multi-2level
(with 10 registered patches, see perl -V for more detail)
Copyright 1987-2007, Larry Wall
Binary build 822 [280952] provided by ActiveState http://www.ActiveState.com
Built Jul 31 2007 19:44:51
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source
kit.
Complete documentation for Perl, including FAQ lists, should be found
on
this system using "man perl" or "perldoc perl". If you have access to
the
Internet, point your browser at http://www.perl.org/, the Perl Home
Page.
$
================================================
The same code is now modified as below:
#!/usr/local/bin/perl
use strict;
use warnings;
$some_var=10;
print $some_var++ . "\n";
print $some_var . "\n";
================================================
After compilation and execution ==>
10
11
================================================
Global symbol "$some_var" requires explicit package name
Global symbol "$some_var" requires explicit package name
Global symbol "$some_var" requires explicit package name
Execution aborted due to compilation errors.
================================================
I don't see why this code snipped should've executed in the first
instance. I have observed this behavior to be exhibited for the
following single character identifiers ($a, $b) that act as scalar
variable names.
Has anybody has had this experience before? Any thoughts?
Regards,
- Tintin