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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:18:59+00:00 2026-05-10T22:18:59+00:00

I have Perl on Mac, Windows and Ubuntu. How can I tell from within

  • 0

I have Perl on Mac, Windows and Ubuntu. How can I tell from within the script which one is which?

Edit: I was asked what I am doing. It is a script, part of our cross-platform build system. The script recurses directories and figures out what files to build. Some files are platform-specific, and thus, on Linux I don’t want to build the files ending with _win.cpp, etc.

  • 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. 2026-05-10T22:19:00+00:00Added an answer on May 10, 2026 at 10:19 pm

    Examine the $^O variable which will contain the name of the operating system:

    print "$^O\n"; 

    Which prints linux on Linux and MSWin32 on Windows.

    You can also refer to this variable by the name $OSNAME if you use the English module:

    use English qw' -no_match_vars '; print "$OSNAME\n"; 

    According to perlport, $^O will be darwin on Mac OS X.


    You can also use the Config core module, which can provide the same information (and a lot more):

    use Config;  print "$Config{osname}\n"; print "$Config{archname}\n"; 

    Which on my Ubuntu machine prints:

    linux i486-linux-gnu-thread-multi 

    Note that this information is based on the system that Perl was built, which is not necessarily the system Perl is currently running on (the same is true for $^O and $OSNAME); the OS won’t likely be different but some information, like the architecture name, may very well be.

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

Sidebar

Related Questions

I have a perl script URL which gives me a ZIP file, it processes
I have a Perl script which maps two drives, and then proceeds to copy
I have a Perl script that uses WWW::Mechanize to read from a file and
I have Perl script which appends a new line to the existing file every
I have a Perl subroutine which returns an array of vaules, and I'd like
I have a Perl script that takes user input and creates another script that
I have a Perl script called replaceUp: #!/usr/bin/perl search=$1 replace=$2 find . -type f
Suppose I have a perl (or python) script that does something highly secretive; I'd
I dont have perl install on windows. I would like to copy the entire
I have a perl script (part of the XMLTV family of grabbers, specifically tv_grab_oztivo

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.