in reply to Code Review on Several Interesting Points

Points.

  1. If you have already called local on $/, it is already undefined. So that line is redundant.
  2. You can indeed move the my into the open.
  3. I prefer seeing parentheses there. You don't actually need them, but I write them anyways. Besides which, if you aren't in the habit of writing them, it is too easy for someone copying you to decide they like writing or as || and not know they are losing the error check.
  4. Speaking of the error check, you aren't testing $!.
  5. If you are using a 3 argument open already so your code documents what you are doing, then I like having your error message say whether you are reading, etc.
  6. Your factoring of work bothers me. Opening a file and slurping it in are things you are likely to have to write a lot. Slurping it just to scan the file is less likely. So I would prefer to see a function to slurp in the file and a separate one to scan through the slurped in file. Then call one with input from the other. An advantage to this arrangement is that your global is not in an altered state while scan is being called...
  • Comment on Re (tilly) 1: Code Review on Several Interesting Points

Replies are listed 'Best First'.
Re: Re (tilly) 1: Code Review on Several Interesting Points
by John M. Dlugosz (Monsignor) on Nov 13, 2001 at 03:07 UTC
    global in an altered state while scan is being called

    Good catch! Thanks.