Is there a command that will return the version of perl?

G

Guy

I am writing a perl script for someone. They gave me the address to one of
their unix servers and they created a couple of directories for me including
a cgi-bin where I can save my .cgi files (actually I was used to .pl files
but I guess they have to be .cgi on this server).

I upload my files to the server using FTP.
I can telnet to it but I think the only access I have is to my directories.

The server is about 3 hours away from here.

I was wondering, if my perl script can detect what version of perl it's
running on. whether it's perl 5.004, 5.6, or whatever.

Or is there an ENV value that I can pick up on it.

Thanks for all,

Guy Doucet
 
S

Sam Holden

I was wondering, if my perl script can detect what version of perl it's
running on. whether it's perl 5.004, 5.6, or whatever.

perldoc perlvar

Particularly the descriptions of the $] and $^V variables.
 
W

William Herrera

I am writing a perl script for someone. They gave me the address to one of
their unix servers and they created a couple of directories for me including
a cgi-bin where I can save my .cgi files (actually I was used to .pl files
but I guess they have to be .cgi on this server).

I upload my files to the server using FTP.
I can telnet to it but I think the only access I have is to my directories.

The server is about 3 hours away from here.

I was wondering, if my perl script can detect what version of perl it's
running on. whether it's perl 5.004, 5.6, or whatever.

Or is there an ENV value that I can pick up on it.

Thanks for all,

Guy Doucet

I use this one once in a while. I don't know who write it originally (anybody
else know)? I only modified it a little.


<<<<<<<<<<<<<
#!/usr/bin/perl
## printenv -- demo CGI program which prints the cgi environment

use strict;
use CGI qw/:standard/;
use CGI::Carp 'fatalsToBrowser';

my $q = new CGI;
my $var;
my $val;

print $q->header, $q->start_html;

foreach $var (sort(keys(%ENV))) {
$val = $ENV{$var};
$val =~ s|\n|\\n|g;
$val =~ s|"|\\"|g;
print $q->p("${var}=\"${val}\"\n");
}

print $q->p(`perl -v`);

print $q->end_html;

<<<<<<<<<<<<<
 
J

Jürgen Exner

Guy wrote:
What about a simple "perl -v"?
[...]
I was wondering, if my perl script can detect what version of perl
it's running on. whether it's perl 5.004, 5.6, or whatever.

Well, you can always call "perl -v" from a Perl script using backticks to
capture the output..

jue
 
G

Gregory Toomey

It was a dark and stormy night, and Guy managed to scribble:
I am writing a perl script for someone. They gave me the address to one of
their unix servers and they created a couple of directories for me
including a cgi-bin where I can save my .cgi files (actually I was used to
.pl files but I guess they have to be .cgi on this server).

I upload my files to the server using FTP.
I can telnet to it but I think the only access I have is to my
directories.

The server is about 3 hours away from here.

I was wondering, if my perl script can detect what version of perl it's
running on. whether it's perl 5.004, 5.6, or whatever.

Or is there an ENV value that I can pick up on it.

Thanks for all,

Guy Doucet

$] contains the version number.
print $];

For a full list of special variables see http://www.rexswain.com/perl5.html

gtoomey
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top