LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 10-30-2003, 05:02 AM   #1
nbp
LQ Newbie
 
Registered: Oct 2003
Posts: 9

Rep: Reputation: 0
renaming ENV hash in Perl


Can we rename the ENV hash in perl ?
Please tell us how.
 
Old 10-30-2003, 05:06 AM   #2
Nightblade_oz
LQ Newbie
 
Registered: Aug 2003
Location: Australia
Distribution: Fedora Core 2
Posts: 24

Rep: Reputation: 15
Rename it? Why?
 
Old 10-30-2003, 05:31 AM   #3
nbp
LQ Newbie
 
Registered: Oct 2003
Posts: 9

Original Poster
Rep: Reputation: 0
We can access environment variables with $ENV{"name"}.
But , we need to access it as $Dict{"name"}, that's what I meant
when I said renaming ENV.
Please get us a solution.
 
Old 10-30-2003, 06:24 AM   #4
Nightblade_oz
LQ Newbie
 
Registered: Aug 2003
Location: Australia
Distribution: Fedora Core 2
Posts: 24

Rep: Reputation: 15
How's this:

Code:
#!/usr/bin/perl

use warnings;
use strict;

my $Dict = \%ENV;

print "$$Dict{HOME}\n";

# OR

print "$Dict->{HOME}\n";
 
Old 11-01-2003, 03:07 AM   #5
paonethestar
Member
 
Registered: Oct 2003
Posts: 47

Rep: Reputation: 16
Dear Nightblade_oz,
Do u mean u understood the question asked by nbp !.He want to use it as $Dict{'HOME'} instead of $ENV{'HOME'} .Does ur sol come under this ???.

Last edited by paonethestar; 11-02-2003 at 06:41 AM.
 
  


Reply



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
Perl and Hash automatic PB0711 Programming 3 09-23-2005 02:14 AM
Generating hash in perl ? MikeFoo1 Programming 3 05-21-2005 06:03 PM
Passing hash of hashes as a parameter (Perl) rose_bud4201 Programming 8 04-21-2005 07:18 PM
Perl: hash tying amnesty_puppy Programming 1 01-17-2005 11:03 PM
Hash-sort like in PERL in C++ nyk Programming 4 06-11-2004 08:40 AM

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

All times are GMT -5. The time now is 01:09 AM.

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