in reply to Re^2: Bareword "SCALAR" not allowed while "strict subs" in use at C:/Perl/site/lib/DateTime/Locale.pm line 41.
in thread Bareword "SCALAR" not allowed while "strict subs" in use at C:/Perl/site/lib/DateTime/Locale.pm line 41.

What happens when you run the following script?

#!/usr/bin/perl use strict; use warnings; use Params::Validate qw( validate validate_pos SCALAR ); print SCALAR, "\n";

And this one?

#!/usr/bin/perl use strict; use warnings; use DateTime::Locale; print "1\n";
  • Comment on Re^3: Bareword "SCALAR" not allowed while "strict subs" in use at C:/Perl/site/lib/DateTime/Locale.pm line 41.
  • Select or Download Code

Replies are listed 'Best First'.
Re^4: Bareword "SCALAR" not allowed while "strict subs" in use at C:/Perl/site/lib/DateTime/Locale.pm line 41.
by nocool (Novice) on Aug 17, 2010 at 20:08 UTC
    When I run the first code I got following error message --
    I save this code with name test.pl

    Name "main::SCALAR" used only once: possible typo at test.pl line 6.
    print() on unopened filehandle SCALAR at test.pl line 6.

    And when I run another piece of code that time I got same error which is a subject line of this thread.
      Did you copy and paste the code? Because it sounds like you missed a comma. (i.e. you have print SCALAR "\n"; in place of print SCALAR, "\n";). If not, your copy of Params::Validate was not correctly built. I just downloaded v0.95 from CPAN and have no problem, using the pure Perl version. You may wish to try downloading the tarball from http://search.cpan.org/CPAN/authors/id/D/DR/DROLSKY/Params-Validate-0.95.tar.gz, expanding it and copying Params-Validate-0.95/lib/Params/Validate.pm and Params-Validate-0.95/lib/Params/ValidatePP.pm into C:\Perl\site\lib\Params, deleting ValidateXS.pm and Validate.xs while you are there. Once this is done, try the script again.
        Thanks For the solution.. atlease I am not getting that SCALAR erro now. I am out of that error now but getting different kind of error.
        Please find below those erorr :-
        Subroutine DateTime::Locale::Base::id redefined at C:/Perl/site/lib/base.pm line 26.
        Subroutine DateTime::Locale::Base::name redefined at C:/Perl/site/lib/base.pm li ne 26.
        Subroutine DateTime::Locale::Base::native_name redefined at C:/Perl/site/lib/bas e.pm line 26.
        Subroutine DateTime::Locale::Base::language redefined at C:/Perl/site/lib/base.p m line 26.
        Subroutine DateTime::Locale::Base::script redefined at C:/Perl/site/lib/base.pm line 26.
        Subroutine DateTime::Locale::Base::territory redefined at C:/Perl/site/lib/base. pm line 26.
        Subroutine DateTime::Locale::Base::variant redefined at C:/Perl/site/lib/base.pm line 26.
        Subroutine DateTime::Locale::Base::native_language redefined at C:/Perl/site/lib /base.pm line 26.
        Subroutine DateTime::Locale::Base::native_script redefined at C:/Perl/site/lib/b ase.pm line 26.
        Subroutine DateTime::Locale::Base::native_territory redefined at C:/Perl/site/li b/base.pm line 26.
        Subroutine DateTime::Locale::Base::native_variant redefined at C:/Perl/site/lib/ base.pm line 26.
        Please help.. thanks in advance