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

Discussion in 'Perl Misc' started by Guy, Dec 2, 2003.

  1. Guy

    Guy Guest

    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
    Guy, Dec 2, 2003
    #1
    1. Advertising

  2. Guy

    Sam Holden Guest

    On Tue, 02 Dec 2003 04:26:40 GMT, Guy <> wrote:
    >
    > 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.

    --
    Sam Holden
    Sam Holden, Dec 2, 2003
    #2
    1. Advertising

  3. On Tue, 02 Dec 2003 04:26:40 GMT, "Guy" <> wrote:

    >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;

    <<<<<<<<<<<<<
    ---
    Use the domain skylightview (dot) com for the reply address instead.
    William Herrera, Dec 2, 2003
    #3
  4. 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
    Jürgen Exner, Dec 2, 2003
    #4
  5. 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
    Gregory Toomey, Dec 2, 2003
    #5
  6. In article <2525430.M6Wg5aDTAh@gregs-web-hosting-and-pickle-farming>,
    Gregory Toomey <> wrote:

    > Guy wrote:
    > >
    > > 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.

    >
    > $] contains the version number.
    > print $];
    >
    > For a full list of special variables see http://www.rexswain.com/perl5.html


    Or even (from a command line):

    perldoc perlvar

    it magically works even without a net connection!

    :)

    big

    --
    'When I first met Katho, she had a meat cleaver in one hand and
    half a sheep in the other. "Come in", she says, "Hammo's not here.
    I hope you like meat.' Sharkey in aus.moto
    Iain Chalmers, Dec 2, 2003
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Greenhorn
    Replies:
    15
    Views:
    812
    Keith Thompson
    Mar 6, 2005
  2. V Green
    Replies:
    0
    Views:
    845
    V Green
    Feb 5, 2008
  3. PA Bear [MS MVP]
    Replies:
    0
    Views:
    957
    PA Bear [MS MVP]
    Feb 5, 2008
  4. MowGreen [MVP]
    Replies:
    5
    Views:
    2,017
    PA Bear [MS MVP]
    Feb 9, 2008
  5. Replies:
    2
    Views:
    159
    Tad McClellan
    Mar 26, 2005
Loading...

Share This Page