Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Dec 18th, 2012  |  syntax: Perl  |  size: 0.34 KB  |  views: 78  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/usr/bin/perl
  2.  
  3. my $in = $ARGV[0];
  4. if (! defined $in) {
  5.         die "Usage: $0 filename";
  6. }
  7. my $out = $in;
  8. $out =~ s%..%~/captain/%;
  9.  
  10. if (! open $in_fh, '<', $in ) {
  11.         die "Can't open '$in': $!";
  12. }
  13.        
  14. if (! open $out_fh, '>', out ) {
  15.         die "Can't write '$out': $!";
  16. }
  17.  
  18. while (<$out_fh>) {
  19.         print out $_;
  20. }
  21.  
  22. close $out_fh;
  23. close $in_fh;
clone this paste RAW Paste Data