Mallik wrote:
>
> Dear Friends,
Hello,
> I have the following code
>
> unless(-d $dir)
> {
> unless(mkdir $dir)
> {
> print "Error\n";
> }
> }
>
> Can I rewrite the above code in the following way
>
> unless (-d $dir | mkdir $dir)
> {
> print "Error\n";
> }
You don't really need the "-d $dir" test at all. Just try to create the
directory.
mkdir $dir or print "Error: $!";
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>