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

Re: [PBML] reading two files from while loop

Expand Messages
  • Jonathan Dunn
    On Tue, 03 Jun 2003 01:13:35 -0000, Joe wrote ... Hows this: ### script #!/usr/local/bin/perl use CGI qw( :standard ) ; use CGI::Carp qw( fatalsToBrowser ) ;
    Message 1 of 4 , Jun 2, 2003
      On Tue, 03 Jun 2003 01:13:35 -0000, Joe wrote
      > Doesnt matter. Preferably Null. But either way is ok with me.
      Hows this:

      ### script

      #!/usr/local/bin/perl

      use CGI qw( :standard ) ;
      use CGI::Carp qw( fatalsToBrowser ) ;
      use strict ;

      my ( $category, %info ) ;

      print header ;
      print start_html ;
      print "<pre>\n" ;

      open( TEST, "<file.txt" ) ;
      open( GOLD, "<gold.txt" ) ;

      print "Starting\n" ;

      while (1) {
      my $Gold = <GOLD> ;
      my $Test = <TEST> ;
      if( defined($Gold) || defined($Test) ) {
      if ( $Test eq $Gold ) {
      # ok
      } else {
      my $string = "Test:$Test , Gold:$Gold" ;
      $string =~ s#\n##g ;
      print "$string\n" ;
      }
      } else {
      last ;
      }
      }

      print "Finished\n" ;
      print end_html ;
      close ;
      exit ;
    Your message has been successfully submitted and would be delivered to recipients shortly.