Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2012
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.38 KB | None | 0 0
  1. open  fh, "<", "b.txt" or die $!;
  2. open  fh1, "<", "a.txt" or die $!;
  3.  
  4. my $i = 0;
  5. while(my $item1 = <fh>)
  6. {
  7.     open fh2, ">>", "a$i.txt" or die $!;
  8.     while(my $item2 = <fh1>)
  9.     {
  10.         if($item1 =~ m/$item2/i)
  11.         {
  12.             print fh2 $item1, $/;
  13.             print fh2 <fh>;
  14.         }
  15.     }
  16.     close fh2;
  17.    
  18.     seek fh1, 0, 0;
  19. }
  20.  
  21. close fh;
  22. close fh1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement