Advertisement
Guest User

Patch Adams

a guest
Mar 4th, 2014
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.52 KB | None | 0 0
  1. use strict;
  2. use warnings;
  3. use autodie;    # Handle i/o errors
  4.  
  5. local $/ = '>'; # Read a '>' delimited record at a time
  6.  
  7. open my $inFH,  '<', 'test.txt';          # Use lexical file handles
  8. open my $outFH, '>', 'test_output.txt';
  9.  
  10. while (<$inFH>) {
  11.     chomp;
  12.     my ($string) = /\n(.+)/s or next;
  13.     $string =~ s/\n//g;                   # In case the sequences are multi-line
  14.  
  15.     my @patches;
  16.     push @patches, substr $string, $_, 11 for 0 .. length($string) - 11;
  17.     print $outFH "@patches\n";
  18. }
  19.  
  20. close $outFH;
  21. close $inFH;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement