Loading ...
Sorry, an error occurred while loading the content.

336Re: little square box  after script runs

Expand Messages
  • acummingsus
    Sep 29, 2005
      --- In ntb-scripts@yahoogroups.com, "rpdooling" <rpdooling@y...> wrote:
      > Alan,
      > Following those links of yours, she had another that just ran it on
      > the last line:
      > if (eof && $] > 5.006) {
      > $badchar = chr(26);
      > s/($badchar)$//;
      > }

      (important stuff at/near bottom after Perl while loop stuff)

      Well, yes. But each iteration of a while loop works/processes one
      line of a ntb file (unless file slurp was used). And this iteration
      repeats. And a (key) 1 (TRUE) is returned as long as lines remain in
      the file.

      Then, last line of file gets iterated/processed. And, now, next . . .

      It's, here's how a while loop terminates: after the last line of file,
      a zero (key) is returned. And, what we speak of here about while is:
      "while it's TRUE (we do this process)". In Perl, a zero is false.

      So, at end of script, *after* the closing bracket of the while loop,
      you *are* at end of file. (so there's no need for the eof function
      given the code is either placed or called in child/sub_routine like
      fashion, placed where I mentioned).

      If you do not place the code where I mentioned and instead have it
      further up in the script, then on each loop you are needlessly doing a
      check that tests if it is the end of file (slowing down the script a bit).

      Look at some more of the archive posts. There was a post therein
      where Sheri had queried about how to do it without multiple/repeat
      checking for the end of the file.

      Oh well, maybe you need to repeatedly check. I cannot remember and I
      may be getting mixed up. And I'm on Linux. And Win is not turned on.

      (perhaps this might better) It can be done with clip code at very end
      of clip as in:

      ^!RunPerl perl_para_moddr


      Search the clip list archives for char 26 or similar will turn up hits.
      > Do the authorities (Jody et al.) know about this?

      I suspect they know something. What, I do not know. Wouldn't hurt to
      check (I suppose).

    • Show all 6 messages in this topic