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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:49:23+00:00 2026-05-22T15:49:23+00:00

I was wondering if there is a way to get Linux commands with a

  • 0

I was wondering if there is a way to get Linux commands with a perl script. I am talking about commands such as cd ls ll clear cp

  • 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-22T15:49:24+00:00Added an answer on May 22, 2026 at 3:49 pm

    You can execute system commands in a variety of ways, some better than others.

    • Using system();, which prints the output of the command, but does not return the output to the Perl script.
    • Using backticks (“), which don’t print anything, but return the output to the Perl script. An alternative to using actual backticks is to use the qx(); function, which is easier to read and accomplishes the same thing.
    • Using exec();, which does the same thing as system();, but does not return to the Perl script at all, unless the command doesn’t exist or fails.
    • Using open();, which allows you to either pipe input from your script to the command, or read the output of the command into your script.

    It’s important to mention that the system commands that you listed, like cp and ls are much better done using built-in functions in Perl itself. Any system call is a slow process, so use native functions when the desired result is something simple, like copying a file.

    Some examples:

    # Prints the output. Don't do this.
    system("ls");
    
    # Saves the output to a variable. Don't do this.
    $lsResults = `ls`;
    
    # Something like this is more useful.
    system("imgcvt", "-f", "sgi", "-t", "tiff", "Image.sgi", "NewImage.tiff");
    

    This page explains in a bit more detail the different ways that you can make system calls.

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

Sidebar

Related Questions

I'm wondering if there is a way to get better information about the location
Wondering if there is any way to get the lambda expressions that result from
Just wondering if there is any way to get the NS records in C#.
I was wondering if there is a way to get a list of results
I was wondering if there is a way to get the URL of the
I was wondering if there was any possible way to get the number (count)
Hi I was wondering if there is any known way to get rid of
I'm wondering if there's a way to write-protect every page in a Linux process'
Hey guys I was wondering if there is a way to get a certain
I am just wondering is there a way to get the value of a

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.