in reply to Re: Re: Array Parse
in thread Array Parse

Obfuscation indeed! What makes this tick? I though the $| had to do with pipes, plumbing and toilets! Please explain?

Replies are listed 'Best First'.
Re: Re: Re: Re: Array Parse
by rdfield (Priest) on Jan 20, 2003 at 15:14 UTC
    Perhaps this helps:
    #perl -e 'print --$| foreach (1..10)' 1010101010

    rdfield

Re: Re: Re: Re: Array Parse
by Anonymous Monk on Jan 20, 2003 at 18:38 UTC
    $! is tied to a variable that is a bit. Therefore it can only be 0 and 1. Set it to a true value and it sets itself to 1. Set it to a false one and it becomes 0. So subtracting 1 from it when it is 0 gives -1 (true) and sets it to 1. Subtracting 1 from 1 gives 0 again.

    When you know how it works, not that complex. But when you first see it it is a bit surprising... (Cue groans.)