home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / perl / os2perl / multilin.t < prev    next >
Text File  |  1991-04-12  |  841b  |  41 lines

  1. #!./perl
  2.  
  3. # $Header: multiline.t,v 4.0 91/03/20 01:50:15 lwall Locked $
  4.  
  5. print "1..5\n";
  6.  
  7. open(try,'>Comp.try') || (die "Can't open temp file.");
  8.  
  9. $x = 'now is the time
  10. for all good men
  11. to come to.
  12. ';
  13.  
  14. $y = 'now is the time' . "\n" .
  15. 'for all good men' . "\n" .
  16. 'to come to.' . "\n";
  17.  
  18. if ($x eq $y) {print "ok 1\n";} else {print "not ok 1\n";}
  19.  
  20. print try $x;
  21. close try;
  22.  
  23. open(try,'Comp.try') || (die "Can't reopen temp file.");
  24. $count = 0;
  25. $z = '';
  26. while (<try>) {
  27.     $z .= $_;
  28.     $count = $count + 1;
  29. }
  30.  
  31. if ($z eq $y) {print "ok 2\n";} else {print "not ok 2\n";}
  32.  
  33. if ($count == 3) {print "ok 3\n";} else {print "not ok 3\n";}
  34.  
  35. $_ = `cat Comp.try`;
  36.  
  37. if (/.*\n.*\n.*\n$/) {print "ok 4\n";} else {print "not ok 4\n";}
  38. `/bin/rm -f Comp.try`;
  39.  
  40. if ($_ eq $y) {print "ok 5\n";} else {print "not ok 5\n";}
  41.