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

Mikko Ronkko

By: a guest on Mar 12th, 2009  |  syntax: Perl  |  size: 0.47 KB  |  views: 58  |  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. use strict;
  3. use warnings;
  4.  
  5. open(my $file, "<", "temp.txt")
  6.     or die "Can't open file: $!";
  7. my $text = do { local $/; <$file> };
  8.  
  9.  
  10. if ($text =~ /^(.*?)\n\n *([A-Z].*?)\n\n *([A-Z][A-Za-z ]+), Vol\. (\d+), No\. (\d+). \([A-Z][a-z\- ]+\., (\d\d\d\d)\), pp\. (\d+-\d+)\.\n\nStable URL:\nhttp:\/\/links.jstor.org/s) {
  11.     print "Authors: $2, Year: $6, Title: $1, Journal: $3, Vol: $4, Iss: $5, Pages: $7 ";
  12. }
  13. else{
  14.         print "Did not find a match.";
  15. }
clone this paste RAW Paste Data