in reply to Re (tilly) 2: Poor Person's Database
in thread Poor Person's Database

Well, there's a bug where if the search is trying to return the last line in the file, and there's no newline, it'll chop the last character off. Did you mean something else?
  • Comment on Re: Re (tilly) 2: Poor Person's Database

Replies are listed 'Best First'.
Re (tilly) 4: Poor Person's Database
by tilly (Archbishop) on Jun 20, 2001 at 20:10 UTC
    I actually meant something else.

    That specific bug is only going to bite if you had a search string that was the whole line and also was the last line in a file without a return. Similarly if $/ is set to a multi-line delimiter (eg \r\n because you are reading a DOS file in Linux) and the string you are looking for happens to include a tab right where a shorter entry has the \r, you may wind up with an incorrect location. (\r comes after \t, but no character should come before \t.)

    But look more carefully, there is another bug lurking in that code aside from the use of chop where chomp is a better fit.