SHARE
TWEET

Mikko Ronkko

a guest Mar 12th, 2009 61 Never
  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. }
RAW Paste Data
Top