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

  • Home
  • SEARCH
  • 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 6754311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:15:52+00:00 2026-05-26T13:15:52+00:00

Could someone kindly point me why this snippet is not compiled: my $crond =

  • 0

Could someone kindly point me why this snippet is not compiled:

my $crond = "/etc/init.d/crond";
if( -e $crond ) {
    my $d = "d";
}
my $crond = "/etc/init.d/cron$d";

Error:

"my" variable $crond masks earlier declaration in same scope at /home/andrew/sandbox/processes2cron.pl line 27.
Global symbol "$d" requires explicit package name at /home/andrew/sandbox/processes2cron.pl line 27.

I tried different variations with ‘my’ but still the scope is defined uncorrectly. Thanks.

  • 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-05-26T13:15:53+00:00Added an answer on May 26, 2026 at 1:15 pm
    my $crond = "/etc/init.d/crond";
    my $d;
    if( -e $crond ) {
        $d = "d";
    }
    $crond = "/etc/init.d/cron$d";
    

    It’s just as the error message says. You’re redeclaring $cron within the same scope, and $d is only defined within the if block, so the compiler expects $d to be a global variable when you use it on the last line, and complains when it can’t find it.

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

Sidebar

Related Questions

Could someone kindly help me get this parsed. I have the following XML. I
I wonder if someone could kindly point me in the right direction. I am
Could someone please explain why the following snippet behaves as it does? l <-
Could someone help me to convert this rule for nginx? RewriteRule ^([^/]*)/([^/]*)/?$ index.php?a=$1&b=$2 [L,NC]
I don't know if anyone could kindly explain this code for me? unsigned int
I have the following input values and I was hoping someone could kindly tell
Could someone please tell me what is wrong with this code? It works fine
Could someone tell me why this doesn't work? def selectAndCopy(x,y,z,w): ctypes.windll.user32.SetCursorPos(x,y) time.sleep(1) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0,
Could someone please tell me why this <%= destroy_password_url @user.password_reset_token %> generates http://localhost:3000/api/destroy_password.4G5EoRVYMUAtiIKqOerKsw routes.rb
Could someone please suggest why this is happening... I’ve got some code to pretty

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.