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 7939007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:58:05+00:00 2026-06-03T22:58:05+00:00

I have a huge system that I’m converting from a cgi to a daemon,

  • 0

I have a huge system that I’m converting from a cgi to a daemon, and I need to find all the variables that end up being global (as in not declared with my $…).
They are probably intended to be scoped locally, but in Perl if you accidentally forget, it doesn’t care, but now I do.

I gotta figure the perl interpreter can tell the difference, so is there a way to get it to tell me? I could go through all the code by hand, looking for declarations, but there are thousands and thousands and thousands of lines of code in this system.

  • 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-03T22:58:07+00:00Added an answer on June 3, 2026 at 10:58 pm

    perldoc strict will show all variables not declared with my:

    $ perl -Mstrict=vars -c -e '$x=5; my $y=7; $z=6;'
    Global symbol "$x" requires explicit package name at -e line 1.
    Global symbol "$z" requires explicit package name at -e line 1.
    -e had compilation errors.
    

    The same thing with a list of files:

    $ perl -Mstrict=vars -c *.pl
    

    See also strictv — how unstrict is your code?; this will give you a short summary of the variables.

    Here is another way using perldoc B::Xref

    $ perl -MO=Xref -e '$x=5; my $y=7; $z=6;'
    
    ... lots of verbose output
    
      Subroutine (main)
        Package (lexical)
          $y                i1
        Package main
          $x                1
          $z                1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a CMS system that we're currently taking the admin back end and
I have several fairly large XML files that represent data exported from a system
I'm designing a messaging system that will have to support a huge amount of
I have huge data which is static. I need to save it within the
I have a huge IQueryable that I want to export directly to Excel for
i have a huge sql query that is attached to the rowsource of a
We have a system that makes a use of 3rd party COM DLL written
I have a huge database that has several tables that hold several million records.
I have a huge web application and I want to use a system which
We have developed a system that uses a single code base, consisting of four

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.