>From owner-macperl-anyperl@cfcl.com Tue Jun 29 22:01:34 1999 Message-Id: <v04205103b39f4f383d90@[199.165.65.101]> In-Reply-To: <199906291100.EAA19568@cfcl.com> References: <199906291100.EAA19568@cfcl.com> Date: Tue, 29 Jun 1999 20:52:18 -0800 Hello, Thanks, Ronald, for the numerous tips, especially useful for a two week old Perl newbie like myself. I must say I was a little sad to see just how many mistakes I had in that short piece of code... I've got a couple more questions... > > unless (@directories eq "") { > >@directories will _never_ eq "". In a scalar context, an array evaluates >to the number of elements in the array. This will be 0 if the array is >empty, or a positive integer if the array is not empty, but certainly never >the null string. My tutorial is the O'Reilly book: Programming Perl (which I must say I'm very happy with), and I thought I read early on that the way Perl parses variables makes "0" = a boolean FALSE = "" (null). I've tested this by setting a scalar to 0 (such a $foo=0) and then to null (such as $foo="") and in either case I'm able to evaluate this with a simple: if ($foo) { &foo; } Does this not work with Arrays? Perhaps above I could have said: unless (!@directories) { ? In which case, what's the difference between if (!@directories) and if (@directories eq "") ? >You should include a useful error message when you die. Point well taken... Actually, I've set up a special error subroutine I call when there's an error - I removed this from the code when I posted it to this mail group in the interests of brevity. :) >Instead of writing the solution from scratch, I would recommend using the >finddepth() function from the File::Find module. I figured there HAD to be a simpler way! :) Thanks Jim and Geoff for suggesting rmtree -- I must admit I wasn't even aware of the modules yet, not yet that far in my Perl manual. Silly me... Anyway, I'm using File::Path successfully (as well as a few other handy modules). Thanks again for the help! :) -Jeremy --------------------------------------------------------- - jeremy@alaskanweb.net - - (PGP available on request) - - http://AlaskanWeb.net/ - Fast and Inexpensive! - - Web hosting, Web design & Computer Consulting - --------------------------------------------------------- ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org