topical media & game development

talk show tell print

professional-program-18-Perl-processLog.pl / pl



  #! /usr/bin/perl
  
  open (INPUT, "userlog.txt") or die "Couldn't open input file!";
  open (OUTPUT, ">userlog.out") or die "Couldn't open output file!";
  
  while (line = <INPUT>) {
      if (line =~ m/^Password: (.*)/) {
          result = `./encryptString $1`;
          if (? != 0) { exit(-1) }
          print OUTPUT "Password: result\n";
      } else {
          print OUTPUT "line";
      }
  }
  
  close (INPUT);
  close (OUTPUT);
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.