About Linux FAQ

Browse More FAQs:

Howto find out perl version

Posted by Vivek Gite [Last updated: June 18, 2008]

Q. How do I find out Perl version by running a cgi script from a webbrowser? How do I find out perl version from a command prompt under Windows or Linux / UNIX operating systems?

A. Perl is acronym for Practical Extraction and Report Language. It is a general-purpose programming language invented in 1987 by Larry Wall. Originally developed for text manipulation. Perl has become extremely popular and is now used for a wide range of tasks, including web development and interface design.

Find perl version from a shell prompt

If you have access to a shell prompt (UNIX/Linux) type following command to find out perl version:
$ perl -v
You can also type above command under Windows / Mac OS X by opening terminal.

Find perl version using a cgi script

If your web hosting server provider don't provide access to a shell, use following perl program to find out perl version:

Short version that avoid starting a new process (see below in comments):

#!/usr/bin/perl
$command= $];
$title = "Perl Version";
 
print "Content-type: text/html\n\n";
print "<html><head><title>$title</title></head><body>";
 
print "
<h1>$title</h1>
 
\n";
print "Perl version : ".$command;

source code - version.pl (download link)

The following code provides a little bit more information:

#!/usr/bin/perl
$command=`perl -v`;
$title = "Perl Version";
 
print "Content-type: text/html\\n\\n";
print "<html><head><title>$title</title></head><body>";
 
print "
<h1>$title</h1>
 
\n";
print $command;
 
print "</body></html>";
 

Upload script to your cgi-bin directory and execute script by typing url http://mydomain.com/cgi-bin/version.pl

Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

Related Other Helpful FAQs:

Discussion on This FAQ

  1. Dave Says:

    It is overkill to run a whole new process to find out the version, just read about Perl’s builtin variables in PERLVAR

    In the code above change

    $command=`perl -v`;
    to
    $command= $]

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , , , , , ,

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.