#!/usr/bin/perl use strict; use warnings; open(my $file, "<", "temp.txt") or die "Can't open file: $!"; my $text = do { local $/; <$file> }; 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) { print "Authors: $2, Year: $6, Title: $1, Journal: $3, Vol: $4, Iss: $5, Pages: $7 "; } else{ print "Did not find a match."; }