home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 2 / RISC_DISC_2.iso / pd_share / utilities / cli / perl / !Perl / t / io / argv next >
Encoding:
Text File  |  1995-04-20  |  847 b   |  36 lines

  1. #!./perl
  2.  
  3. # $RCSfile: argv.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:25 $
  4.  
  5. print "1..5\n";
  6.  
  7. open(try, '>Iotmp') || (die "Can't open temp file.");
  8. print try "a line\n";
  9. close try;
  10.  
  11. $x = `perl -e 'while (<>) {print \$.,\$_;}' Iotmp Iotmp`;
  12. if ($x eq "1a line\n2a line\n") {print "ok 1\n";} else {print "not ok 1\n";}
  13.  
  14. $x = `echo foo|perl -e 'while (<>) {print $_;}' Iotmp -`;
  15.  
  16. if ($x eq "a line\nfoo\n") {print "ok 2\n";} else {print "not ok 2\n";}
  17.  
  18. $x = `echo foo|perl -e 'while (<>) {print $_;}'`;
  19.  
  20. if ($x eq "foo\n") {print "ok 3\n";} else {print "not ok 3 :$x:\n";}
  21.  
  22. @ARGV = ('Iotmp', 'Iotmp', '/dev/null', 'Iotmp');
  23. while (<>) {
  24.     $y .= $. . $_;
  25.     if (eof()) {
  26.     if ($. == 3) {print "ok 4\n";} else {print "not ok 4\n";}
  27.     }
  28. }
  29.  
  30. if ($y eq "1a line\n2a line\n3a line\n")
  31.     {print "ok 5\n";}
  32. else
  33.     {print "not ok 5\n";}
  34.  
  35. `rm -f Iotmp`;
  36.