opendir problem

Tkil tkil at
Thu Jun 6 20:20:04 CDT 2002

>>>>> "Tom" == Tom Keller <kellert at> writes:
Tom>   kellert% ~/bin/
Tom> Enter the parent directory for your input data directories:
Tom> /Volumes/Core\ Lab/Vibrio/

Tom> Enter the parent directory for output of text files: /Volumes/Core\
Tom> Lab/Vibrio/current_vibrio.seq

Tom> Can't open parent directory /Volumes/Core\ Lab/Vibrio/: No such file
Tom> or directory at /Users/kellert/bin/ line 25, <STDIN> line
Tom> 2.

Tom> I'm stumped. Why doesn't opendir work with $parent??

You don't need to backslash spaces in paths, unless they're going to
be interpreted by the shell or other quote-mangling.  (Or, you can do
your own backslash processing.)

Did you try it with no backslash at all?  That is, just type in

/Volumes/Core Lab/Vibrio

and see if that works?

More to the point, you're not checking the return value from "mkdir",
which should have alerted you earlier that something was amiss.  So,
instead of

| mkdir $out_dir unless -e $out_dir && -d _;

Consider something like:

| unless (-d $out_dir)
| {
|     mkdir $out_dir
|       or die "couldn't mkdir '$out_dir': $!";
| }

If you're worried about having to make multiple levels of directories,
investigate the File::Path module.


More information about the Pdx-pm-list mailing list