in reply to Re: Searching for two lines that begin with the same string
in thread Searching for two lines that begin with the same string

How are you populating $line from the file? I have tried opening the file then going into the while loop, but it doesnt seem to be reading the lines into the while loop.
  • Comment on Re^2: Searching for two lines that begin with the same string

Replies are listed 'Best First'.
Re^3: Searching for two lines that begin with the same string
by ikegami (Patriarch) on Dec 18, 2006 at 16:57 UTC

    We used <>, which reads from the files named on the command line, or STDIN if none were specified on the command line. You could read from any other file handles instead just by specifying it.

    open(my $data_fh, '<', $data_file_name) or die("Unable to open data file \"$data_file_name\": $!\n"); while (my $line = <$data_fh>) { . . .

    You should replace the word "data" with something more descriptive, at least in the error message.