LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-29-2004, 04:43 AM   #1
Bassam
Member
 
Registered: Mar 2003
Location: Malaysia
Posts: 63

Rep: Reputation: 15
Question What does the syntax-- $ENV{'REMOTE_HOST'} --mean in Perl?


Hello Guys,
I was reading some refernce about CGI with Perl programming and I found in one of the programes the following statment
Code:
$remote_host = $ENV{'REMOTE_HOST'};
Can anyone tell me what does this syntax mean?, what exactly the brace brakets mean?

I am still new in Perl programming, but I have not seen such syntax before?
I would be thankful if you tell me where can I read about such syntax.



Thanks for the help
Bassam
 
Old 03-29-2004, 05:36 AM   #2
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,516

Rep: Reputation: 239Reputation: 239Reputation: 239
$ENV is a hash (associate array) of the environment
variables available and their values.
so this means get the value of the env.
variable REMOTE_HOST (if it exists).

It doesn't only count in CGI it works for normal shell
environment too:

observe:
Code:
billym.primadtpuat>echo $PWD
/export/home/billym
billym.primadtpuat>
billym.primadtpuat>perl
print "\n\n$ENV{'PWD'}\n\n";
^D

/export/home/billym
 
Old 03-31-2004, 08:44 AM   #3
eric.r.turner
Member
 
Registered: Aug 2003
Location: Planet Earth
Distribution: Linux Mint
Posts: 216

Rep: Reputation: 31
Quote:
Originally posted by bigearsbilly
$ENV is a hash (associate array) of the environment
variables...
I know this is a bit picky, but %ENV is the hash (not $ENV.) The $ in $ENV{'REMOTE_HOST'} indicates that the value associated with the REMOTE_HOST key is a scalar.
 
Old 03-31-2004, 08:54 AM   #4
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,516

Rep: Reputation: 239Reputation: 239Reputation: 239
good point well made.



regards, billy
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
env variable for proxy: syntax FrayAdjacent Linux - Networking 10 07-13-2005 06:44 PM
Perl system function syntax Crashed_Again Programming 2 03-20-2004 05:00 AM
renaming ENV hash in Perl nbp Programming 4 11-01-2003 04:07 AM
emacs color-syntax highlighting with perl SerfurJ Linux - Software 2 09-22-2003 09:40 AM
perl syntax jenny_psion Programming 2 08-13-2003 01:23 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration