camelcom has asked for the wisdom of the Perl Monks concerning the following question:
I have to clean-up a filesystem on a box with an old version of perl (5.004) and no extra modules (& I don't want to use find -exec...)
I would normally use File::Find, File::Recurse, File::basename, etc. but I can't, so I'm using opendir, readdir + recursion
Can someone please confirm that the following is ALWAYS reliable (i.e. no gotchas) on a SunOS 5.6 box?...
$file_path =~ /(.*)\/(.*)/; my ($dir, $file) = ($1, $2);
I think I'm being a bit paranoid as the first .* is greedy, but any comments, just in case, please?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: dir / file split
by svenXY (Deacon) on Sep 28, 2007 at 13:07 UTC | |
by oha (Friar) on Sep 28, 2007 at 13:26 UTC | |
by camelcom (Sexton) on Sep 28, 2007 at 13:17 UTC | |
|
Re: dir / file split
by perlfan (Parson) on Sep 28, 2007 at 13:16 UTC | |
by camelcom (Sexton) on Sep 28, 2007 at 13:27 UTC | |
by perlfan (Parson) on Sep 28, 2007 at 13:48 UTC | |
|
Re: dir / file split
by grinder (Bishop) on Sep 28, 2007 at 14:46 UTC | |
by camelcom (Sexton) on Sep 28, 2007 at 15:06 UTC | |
by johngg (Canon) on Sep 28, 2007 at 15:20 UTC | |
by camelcom (Sexton) on Sep 28, 2007 at 15:55 UTC | |
|
Re: dir / file split
by johngg (Canon) on Sep 28, 2007 at 14:29 UTC | |
|
Re: dir / file split
by girarde (Hermit) on Sep 29, 2007 at 04:21 UTC | |
|
Re: dir / file split
by sanPerl (Friar) on Sep 29, 2007 at 17:35 UTC |