Error message during runtime

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NOTSomebody
    New Member
    • Jul 2008
    • 13

    Error message during runtime

    When I tried to run my application, it says

    Global symbol "%files" requires explicit package name at c:\codes\testin g2.pl line 9.

    Can anybody tell me what does this means and how to I solve this? I googled it but I still dont get it.
  • eWish
    Recognized Expert Contributor
    • Jul 2007
    • 973

    #2
    When you are using the strict pragma you have to declare your variables first. This is done using the my function.

    Code:
    [URL=http://perldoc.perl.org/functions/use.html]use[/URL] strict;
    
    [URL=http://perldoc.perl.org/functions/my.html]my[/URL] %hash;
    ------------------------------------------------------------
    Pragmas (perl 5.8.8) used :
    • strict - Perl pragma to restrict unsafe constructs




    --Kevin

    Comment

    • KevinADC
      Recognized Expert Specialist
      • Jan 2007
      • 4092

      #3
      Originally posted by eWish
      When you are using the strict pragma you have to declare your variables first. This is done using the my function.

      Code:
      [URL=http://perldoc.perl.org/functions/use.html]use[/URL] strict;
      
      [URL=http://perldoc.perl.org/functions/my.html]my[/URL] %hash;
      ------------------------------------------------------------
      Pragmas (perl 5.8.8) used :
      • strict - Perl pragma to restrict unsafe constructs




      --Kevin
      The code converter is no longer a virgin. :)

      Comment

      • SUHASbioinfo
        New Member
        • Oct 2007
        • 2

        #4
        When I tried to run my application, it says

        Global symbol "%files" requires explicit package name at c:\codes\testin g2.pl line 9.

        Can anybody tell me what does this means and how to I solve this? I googled it but I still dont get it.
        try below code.

        Remember whenever u r using use strict pragma u should declare all variables with my.

        Code:
        use strict;
        
        my %files;
        Last edited by eWish; Aug 16 '08, 03:41 PM. Reason: Added Quote and Code Tags

        Comment

        • KevinADC
          Recognized Expert Specialist
          • Jan 2007
          • 4092

          #5
          Originally posted by SUHASbioinfo
          When I tried to run my application, it says

          Global symbol "%files" requires explicit package name at c:\codes\testin g2.pl line 9.

          Can anybody tell me what does this means and how to I solve this? I googled it but I still dont get it.

          try below code.

          Remember whenever u r using use strict pragma u should declare all variables with my.

          use strict;

          my %files;
          post your code perl, use code tags.

          Comment

          Working...