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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:52:53+00:00 2026-05-24T20:52:53+00:00

How do I execute a shell command in perl if I call it through

  • 0

How do I execute a shell command in perl if I call it through a sub routine?

For example, I can run this on the command line to get a particular value:

mycert-util --show test.user.myuser_cd

I want to run this command within a perl subroutine and call it. For example my routine would be get_auth and I want to print out the value of get_auth.

code:

use strict;
use warnings;

#&get_auth;  
#get_auth();

print "The value is: get_auth() \n";

sub get_auth
{
  $exec=`mycert-util --show test.user.myuser_cd`; 
}
  • 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-24T20:52:54+00:00Added an answer on May 24, 2026 at 8:52 pm

    Your problem is not the sub, but how you call it. You cannot place sub calls inside quotes. Some equivalent alternative features below.

    use feature qw(say);
    say "The value is: ", get_auth();
    
    sub get_auth {
       return qx(mycert-util --show test.user.myuser_cd); 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to execute shell script in command line like this : counter=`ps
I can thought that it will open a shell, execute the parameter (shell command)
On the Windows command line and cygwin bash I can execute the following without
how can I execute a shell command in the background from within a bash
I would like to execute WScript.Shell command using Run and set it to be
I want to execute following command in shell script cp /somedire/*.(txt|xml|xsd) /destination/dir/ But this
Is this possible in AppleScript? Do I just want to execute a shell command
How do I execute the following shell command using the Python subprocess module? echo
How can I execute a.exe using the Cygwin shell? I created a C file
I have Cygwin installed, I want to execute something like this on the command

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.