in reply to Re: 2: recursive difficulty
in thread recursive difficulty

That's one of the problem I had at the beginning. By copy and paste, all those \t's are gone. I just manually added those \t's back to your __DATA__. Those \t's are what you used in your split.

Replies are listed 'Best First'.
Re: Re: Re: 2: recursive difficulty
by jjohhn (Scribe) on Mar 10, 2003 at 00:32 UTC
    That seems not to be working for me, despite using ^V. I think it is my vim expandtab setting. I tried pipes as delimiters, but split /|/ seemed to split between characters for some reason:

    ch: v, par: e
    in my little debug printout.

    I am a litttle baffled.

      The first argument to split is a regex, not a string. /|/ says to match either nothing or nothing. Split, as documented, will split every character when giving a regex that matches nothing.


      Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

      theorbtwo answered your problem with split /|/, I suggest that you use the magic split ' ', $line or if working on $_, simply split. This splits on one or more whitespace and ignores empty fields (because of spurious whitespace) at the start and end of your line which should work best in your case.

      -- Hofmator