Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Getting a List of Files Via Glob

by merlyn (Sage)
on May 28, 2000 at 10:20 UTC ( #15185=note: print w/ replies, xml ) Need Help??

in reply to Getting a List of Files Via Glob

If you don't mind a chdir, then add it first:

chdir $area or die "chdir $area: $!"; @file_list = glob("@files");

-- Randal L. Schwartz, Perl hacker

Comment on Re: Getting a List of Files Via Glob
Download Code
Replies are listed 'Best First'.
RE: Re: Getting a List of Files Via Glob
by Zoogie (Curate) on May 30, 2000 at 21:14 UTC
    I considered this, but I'd have to return the original working directory at the sub, since other subs assume that the working dir hasn't changed.

    I suppose I could save the original working dir with
    $prevdir = `pwd`;
    But executing the shell command doesn't seem like it would be much more efficient than mapping the directory name on to each glob and then chopping it off...

      Use Cwd. It's a standard module.
      use Cwd; my $dir = cwd(); chdir $otherdir; # do something chdir $dir;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://15185]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2015-11-26 00:22 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (693 votes), past polls