coldfingertips has asked for the wisdom of the Perl Monks concerning the following question:

This prints everything but the person's IP address, can someone help?
print "Your IP address is: $ENV{REMOTE_USER}";

Replies are listed 'Best First'.
Re: I can't find the IP address!
by Coruscate (Sexton) on Jun 21, 2003 at 20:17 UTC

    REMOTE_ADDR should contain the IP address. Check out your values by running this. Note that REMOTE_USER will contain the basic authentication username if it is used. (You know those boxes that come up asking for a username and password. If you login, REMOTE_USER will contain the username you logged in as).

    #!/usr/bin/perl -w use strict; print "Content-type: text/html\n\n"; print "$_: $ENV{$_}<br />" for keys %ENV;


    If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, please reply to this node or /msg me to inform me as to what is wrong with the post, so that I may update the node to the best of my ability.

      FORE!

         print map{"$_ is $ENV{$_}\n"} sort keys %ENV;

        Come on now, really.

        print "$_ is $ENV{$_}\n" for sort keys %ENV;

        1 character less, plus it beats the snot out of using map where it is not needed.


        If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, please reply to this node or /msg me to inform me as to what is wrong with the post, so that I may update the node to the best of my ability.

Re: I can't find the IP address!
by Tomte (Priest) on Jun 21, 2003 at 20:17 UTC

    Look it up here

    I required acquired this list via almighty google, and so could you have done it;-)

    regards,
    tomte


    Hlade's Law:

    If you have a difficult task, give it to a lazy person --
    they will find an easier way to do it.

Re: I can't find the IP address!
by coldfingertips (Pilgrim) on Jun 21, 2003 at 20:20 UTC
    Thanks you two! It works now :)