in reply to Re: Run 2 Subroutines after a die
in thread Run 2 Subroutines after a die

Would I be correct in assuming that

if(! open TST, ">>$var1"){ }

would just be another way of doing

unless(open TST, ">>$var1"){ }

If so, is this just another way of doing things or are there further benefits for using unless. I did once read that the code we use should be readable to humans and that the computers will still interpret our code. Is this a case of unless being easier to read than if not?

-----
Of all the things I've lost in my life, its my mind I miss the most.

Replies are listed 'Best First'.
Re: Re: Re: Run 2 Subroutines after a die
by Juerd (Abbot) on Oct 03, 2002 at 07:47 UTC

    Would I be correct in assuming that if(! open TST, ">>$var1"){ } would just be another way of doing unless(open TST, ">>$var1"){ }

    Yes, you would.

    If so, is this just another way of doing things or are there further benefits for using unless. I did once read that the code we use should be readable to humans and that the computers will still interpret our code. Is this a case of unless being easier to read than if not?

    unless (foo) is just another way of writing if (not (foo)). It's up to you to decide what you find better readable.

    - Yes, I reinvent wheels.
    - Spam: Visit eurotraQ.