home *** CD-ROM | disk | FTP | other *** search
/ Freelog 15 / FREELOG 15.ISO / WebMaster / Perl / PERL5106.ZIP / perl5 / ntt / Io / inplace.ntt < prev    next >
Encoding:
Text File  |  1996-01-31  |  605 b   |  31 lines

  1. #!./perl
  2.  
  3. $^I = '.bak';
  4.  
  5. # $RCSfile: inplace.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:29 $
  6. # revised for NT 95/04/07
  7.  
  8. print "1..2\n";
  9.  
  10. @ARGV = ('a','b','c');
  11.  
  12. foreach (@ARGV) {
  13.     open(TMP, '>' . $_ ) || warn $!;
  14.     print TMP "foo\n";
  15.     close TMP;
  16. }
  17.  
  18. while (<>) {
  19.     s/foo/bar/;
  20. }
  21.  
  22. continue {
  23.     print;
  24. }
  25.  
  26. if (`type a`.`type b`.`type c` eq "bar\nbar\nbar\n") {print "ok 1\n";} else {print "not ok 1\n";}
  27.  
  28. if (`type a.bak`.` type b.bak`.`type c.bak`  eq "foo\nfoo\nfoo\n") {print "ok 2\n";} else {print "not ok 2\n";}
  29.  
  30. unlink 'a', 'b', 'c', 'a.bak', 'b.bak', 'c.bak';
  31.