develooper Front page | perl.beginners | Postings from April 2002

Re: 2 questions

Thread Previous | Thread Next
From:
John W. Krahn
Date:
April 2, 2002 16:11
Subject:
Re: 2 questions
Message ID:
3CAA4843.656B6743@acm.org
Glenn Cannon wrote:
> 
> Hi all,

Hello,

> Couple of questions from a newbie...
> 
> 1)  How can I print the current directory name?

use Cwd;
my $dir = cwd;
print "The current directory is $dir\n";


> 2)  How can I check to see if a file I know the name of exists?

if ( -e $filename ) {
    print "$filename exists\n";
    }



John
-- 
use Perl;
program
fulfillment

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About