Re: Current directory?

2005-09-29 Thread John W. Krahn
[EMAIL PROTECTED] wrote:
 Hi there!

Hello,

 I want to get the current environment variable (current directory), and I
 type like this:
 
 $currentpath = %ENV;
 
 and I get something like 37/64
 instead of maybe usr/username/test
 
 How do I get current directory?

perldoc Cwd


John
-- 
use Perl;
program
fulfillment

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




Re: Current directory?

2005-09-29 Thread Jeff Peng
#!/usr/bin/perl
use strict;
use Cwd;

print getcwd,\n; #get the current path
print $ENV{PATH};  #get the path from environment variable

2005/9/29, [EMAIL PROTECTED] [EMAIL PROTECTED]:
 Hi there!

 I want to get the current environment variable (current directory), and I
 type like this:

 $currentpath = %ENV;

 and I get something like 37/64
 instead of maybe usr/username/test

 How do I get current directory?

 /G




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





--
  Jeff Peng
  [EMAIL PROTECTED]

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




Re: Current directory?

2005-09-29 Thread Gustav Wiberg

Hi there!

Thanx! I'll try that! :-)

/G

- Original Message - 
From: Jeff Peng [EMAIL PROTECTED]

To: [EMAIL PROTECTED]
Cc: beginners@perl.org
Sent: Thursday, September 29, 2005 10:27 AM
Subject: Re: Current directory?


#!/usr/bin/perl
use strict;
use Cwd;

print getcwd,\n; #get the current path
print $ENV{PATH};  #get the path from environment variable

2005/9/29, [EMAIL PROTECTED] [EMAIL PROTECTED]:

Hi there!

I want to get the current environment variable (current directory), and I
type like this:

$currentpath = %ENV;

and I get something like 37/64
instead of maybe usr/username/test

How do I get current directory?

/G




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






--
 Jeff Peng
 [EMAIL PROTECTED]

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




--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.8/114 - Release Date: 2005-09-28



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




Re: Current directory?

2005-09-29 Thread Chris Devers
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




Re: current directory

2004-09-29 Thread Errin Larsen
Hi Urs,

You should look at Cwd:

  perldoc Cwd

That capital C in Cwd is relevant.

--Errin


On Wed, 29 Sep 2004 15:24:06 +0200, Urs Wagner [EMAIL PROTECTED] wrote:
 Hello
 
 How can I find out the current directory? I call chdir, afterwards I
 should switch back to the old one.
 
 Thanks
 
 Urs
 
 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 http://learn.perl.org/ http://learn.perl.org/first-response
 


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




Re: current directory

2004-09-29 Thread John W. Krahn
Urs Wagner wrote:
Hello
Hello,
How can I find out the current directory? I call chdir, afterwards I 
should switch back to the old one.
perldoc Cwd
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



RE: Current Directory Name

2002-10-30 Thread Toby Stuart

use strict;
use Cwd;

$dir = cwd;
print $dir;

 -Original Message-
 From: Johnstone, Colin [mailto:Colin.Johnstone;det.nsw.edu.au]
 Sent: Thursday, October 31, 2002 11:20 AM
 To: '[EMAIL PROTECTED]'
 Subject: Current Directory Name
 
 
 Gidday All,
 
 How do I find out the name of the current directory I am in 
 before I do chdir.
 
 Colin Johnstone 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]