Glenn..

to print the current directory name...try

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

$curr = cwd();
print "$curr\n";

easy enough
----

this is bit longer example.. you could prolly do it another way..but 
this is how *I* would do it
---
#!/usr/bin/perl -w
use strict;
use Cwd;

my $curr = cwd(); (sets $curr to the current directory the script is 
being ran from)
my @files = &getdirfiles();
my $nof = "the name of the file you're looking to see exists";

if (grep /^$nof$/, @files) {
    print "File $nof exists\n";
    $nof = '';
} elsif (!grep /^$nof$/, @files) {
    print "File $nof does not exsist";
    $nof = '';
}

sub getdirfiles {
opendir(CURRDIR, $curr) or die "Can't open directory\n";
@files = readdir(CURRDIR);
closedir(CURRDIR);
return @files;
}
----

hope those examples help...

~Eric
On Tuesday, April 2, 2002, at 06:20 PM, Glenn Cannon wrote:

> Hi all,
>
> Couple of questions from a newbie...
>
> 1)  How can I print the current directory name?
>
> 2)  How can I check to see if a file I know the name of exists?
>
> Thx,
>
> Glenn
>
>
> --
> 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]

Reply via email to