Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8146237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:55:44+00:00 2026-06-06T13:55:44+00:00

I have just found a script we are using which has a sub that

  • 0

I have just found a script we are using which has a sub that says my %INC in it, where it stores some values about incentives, thus %INC. This never seemed to be a problem, or no-one ever noticed. For me it produced 20 screens of redefine warnings, because %INC, holding all the file names Perl has done, required or used, was pretty large, and now is ('stuff' => 123).

Do I really have to go and rename every single reference to this in the sub, or is there another way to make Perl forgive this … ?


Here’s a part of the output of:

print Dumper \%INC; # I added this line
my %INC;             
print Dumper \%INC; # I added this line
exit;               # I added this line

Output:

          [...]
          'SqlConnect.pm' => 'lib1/SqlConnect.pm',
          'Lib/RateRequest.pm' => 'Lib/RateRequest.pm'
        };
$VAR1 = {};
[Fri Jun 29 16:09:13 2012] live_batch_test.pl: Subroutine export_fail redefined at /usr/lib/perl5/5.14.2/Carp.pm line 43.
[Fri Jun 29 16:09:13 2012] live_batch_test.pl: Subroutine _cgc redefined at /usr/lib/perl5/5.14.2/Carp.pm line 45.
[Fri Jun 29 16:09:13 2012] live_batch_test.pl: Subroutine longmess redefined at /usr/lib/perl5/5.14.2/Carp.pm line 51.
[Fri Jun 29 16:09:13 2012] live_batch_test.pl: Subroutine shortmess redefined at /usr/lib/perl5/5.14.2/Carp.pm line 71.
[...] (Snipped like 20 screens of redefine warnings)

The warnings only show if I create an object of one of my classes (which happens to contain SOAP::WSDL so it has a lot of stuff in it). I’m not sure why those are redefine warnings. If %INC is empty, how can it know stuff is being redefined?


Update:

It seems you actually can create a lexical my %INC.

use strict; use warnings; use Data::Dumper;
print Dumper \%INC;
{
  my %INC = ('asdf' => 'asdf');
  print Dumper \%INC;
}
print Dumper \%INC;

Produces (snipped):

          'feature.pm' => 'C:/Perl/lib/feature.pm'
        };
$VAR1 = {
          'asdf' => 'asdf'
        };
$VAR1 = {
          'warnings/register.pm' => 'C:/Perl/lib/warnings/register.pm',

The problem in my case does not seem to be the my %INC, but rather the %INC = &sub_that_has_my_percent_INC_and_returns_it() in the script that I actually have to require. Now that, in turn, also has use vars qw(%INC). Replacing it… well, I’m not sure what that is going to break.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T13:55:46+00:00Added an answer on June 6, 2026 at 1:55 pm

    The global variable %INC (or %main::INC or %::INC) is a completely different variable from the lexically scoped %INC, created with my. You can safely use my %INC in your subroutine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just started spring, I found that somewhere we are using handlerequest() method
I am learning Java and just found that the Interface can have fields, which
Just random pick some methods that I have found: sforce.connection.describeSObject sforce.SearchResult sforce.sObject sforce.LeadConvert() sforce.connection.create()
I have just found this great tutorial as it is something that I need.
I have an interview tomorrow morning and just found out that I will also
I have a question that I just don't feel like I've found a satisfactory
I have just created a report in Report Manager using a Stored Procedure which
PSPS: (a Pre-scripted Post-script) It has just come to mind that a more prescient
I have a msbuild script that includes creation of a few PDF's using PDF
Ok I have seen many posts on this script. Which can be found..... http://www.white-hat-web-design.co.uk/blog/resizing-images-with-php/

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.