home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / handson / files / copyperl.exe / myprog.pl
Encoding:
Perl Script  |  2000-02-04  |  351 b   |  22 lines

  1. #!/usr/bin/perl
  2.  
  3. $in = "";
  4. @lines = ();
  5.  
  6. print "Enter some text >";
  7. while($in = <STDIN>) {
  8.     print "\n";
  9.     last if ($in =~ /^quit$/i);
  10.     push(@lines, $in);
  11.     print "Enter some text >";
  12. }
  13. chomp @lines;
  14. print "\n";
  15. print "You typed:\n";
  16.  
  17. for ($i = 0; $i <= scalar(@lines); $i++) {
  18.     print sprintf("%03d", $i), $lines[$i], "\n";
  19. }
  20.  
  21. exit;
  22.