in reply to parsing directory glob in config file

$b = "/opt/*"; @a = < $b >;

See also: File::Glob

Replies are listed 'Best First'.
Re: Re: parsing directory glob in config file
by gnu@perl (Pilgrim) on Sep 13, 2002 at 19:36 UTC
    I had been trying that like this:
    my @files; open (CFG,"<$ENV{HOME}/bin/$configFile") or die "Cannot Open Config Fi +le: $!\n"; while (<CFG>){ chomp; s/ \d+$//; @files = < $_ >; } close(CFG); print join ("\n", @files);

    But I get "glob failed (child exited with status 1) at ./old_file_scrub line XX". If I trim the entry in the config file to the point that there is only 1 "*" in it, it works fine, but not with both.

      You'll need to split the path at each wildcard, expand each level, concatenate the next piece to each result, and so forth. That's not particularly fun, but hey, you'll be learning!

        Yeah, that was the first idea, and it is still an option. I was hoping to find some ultracool superslick way (I'm lazy) to do this. Thanks for the input, it's appreciated.
Re: Re: parsing directory glob in config file
by gnu@perl (Pilgrim) on Sep 13, 2002 at 19:59 UTC
    Also, this is a 5.005 box, File::Glob is not on it.