in reply to Is this the most elegant way to code directory lookup?
Some comments:
unless (-d $srcdir && -d $destdir )
It's better not to use unless, unless for simple conditionals ;^).
opendir(INDIR,$srcdir) || die
Better use lexical filehandles. Also, I don't like to use parentheses, it makes the code more perlish:
opendir my $indir, $srcdir or die "blah: $!";unless (-d || $_ eq "." || $_ eq "..") {
Same as above. Quick, what does this do?
unless ($bar =~ /bar/ or $baz !~ /qux/ and defined $undef)`tar -cz $_ -f $_.tar.gz`;
Use backticks when you are going to use the output of the command. This is not the case, so you better use system.
Update: Oh, there's a recent thread about unless, be sure to check it out.
--
David Serrano
|
|---|