in reply to Print to a file then use file content for test?

In your first code block, you should probably close MISS after you are done looping through HOSTS This might be the problem. The file won't get flushed and closed until the script exits...

In the second block of code, it looks like you are pulling off the first line into $miss but aren't using $miss later (References to it are commented out.) You should probably comment that line out.


"Look, Shiny Things!" is not a better business strategy than compatibility and reuse.

Replies are listed 'Best First'.
Re^2: Print to a file then use file content for test?
by ikegami (Patriarch) on Jan 04, 2005 at 22:47 UTC

    In addtion to the problems osunderdog pointed out,

    1) It's better to use while (<MISS>) (which reads the file one line at time) than foreach (<MISS>) (which loads the entire file into memory for no reason).

    2) You don't need my $miss=<MISS>; in the first script either. Why are you reading from a file you opened for write-append?

      Thanks for the input I'll make those corrections. Any ideas on the difference between a file I write and one generated by my first script?

        We told you how to fix two sources of differences. A third possibility is that the scripts you were using were different than the versions you showed us. (Yeah, I know you didn't do it on purpose if this is the case, but it's probably happened to all of us at some point.)

        If it still doesn't work, we'll need to see the files. If you're afraid of losing hidden characters, you could always show the output of od -c miss.

Re^2: Print to a file then use file content for test?
by lcollins (Novice) on Jan 05, 2005 at 14:44 UTC
    Update Monks: I moved this code to a solaris box and it works fine! The box it is running on now is a linux machine. Any Linux gurus out there seen this?
      please ignore the section on it working on Solaris. it does not work on solaris either.