On Monday 19 Jan 2004 10:12 am, Mallik wrote:
> Dear Friends,
>
> 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";
> }
>
> Thanks in advance,
>
> Mallik.

Hi Malik,

print "error\n" unless (-d 'fred' || mkdir 'fred');

worked for me.  The problem you have is that you used the pipe symbol (one 
v-bar) instead of the OR symbol (two v-bars)

Gary
-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to