On Thu, 29 Sep 2005 [EMAIL PROTECTED] wrote:

> I want to get the current environment variable (current directory), and I
> type like this:
> 
> $currentpath = %ENV;

Why do you expect this to do anything useful?

You're assigning the contents of a hash into a single scalar.

That will almost never do anything useful.

As others noted, if you want a specific element from a hash, you have to 
name it explicitly --

    $currentpath = $ENV{PWD};

-- or, as another person noted, use the Cwd module to do this in a more 
guaranteed to be portable way. 

But in any case, assigning a (full) hash to a scalar will never work :-)



-- 
Chris Devers

6f9A/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to