in reply to Re: Help to slurp records - $/ maybe?
in thread Help to slurp records - $/ maybe?

hmerrill,
IMHO, it is much simpler to have $/ = ""; than it is to have labels, redo statements, and variable flags.

Cheers - L~R

Replies are listed 'Best First'.
Re: Re: Re: Help to slurp records - $/ maybe?
by halley (Prior) on May 02, 2003 at 14:18 UTC

    If $/ = ""; works, great. But it won't for the problem as you stated.

    What happens when someone needs to insert a 'Field 2b' in the format six months down the road? You would have to fully rewrite a grok-at-once gimmick, but you'd only have to add the support for a new field type if it were a sensible loop.

    --
    [ e d @ h a l l e y . c c ]

      halley,
      I am not sure I understand what you are saying. I realize that $/ = ""; doesn't work for my problem. I was just illustrating that it was a lot easier and was hoping to find a similar easy solution.

      As far as having to insert fields - that's not a problem. The record delimeter is and always will be the same thing. What is in between doesn't matter. The problem is that I can't see anything between the end of one record and the start of the next that can be used as a delimiter.

      L~R

Re: Re: Re: Help to slurp records - $/ maybe?
by hmerrill (Friar) on May 02, 2003 at 15:38 UTC
    Debatable - I do conceed that the iterative approach means more code, keeping track of flags, etc. - it's not pretty. But I'd have to see a finished slurp example setting $/ = "" before judging that to be the better option. In all likelihood the slurp example may indeed come out on top, but its ease of understanding and maintainability would be greatly enhanced by a generous comment spelling out exactly what the thing does. Whatever you decide on as the final winner, post in this thread.