#!/usr/bin/perl -w my %case = (); # case hash my $judges = ''; # temp key open (IN, "/Users/MicWood/Documents/Perl/Opinion\ Scripts/output.txt"); $/=""; # paragraph input mode while () { if (/^JUDGES:\s(.+)\n\n/s){ $case{'judges'}=$1}; next;} print "before:\n"; print $case{'judges'}; $case{'judges'}=~ s/\n/ /g; print "\nafter:\n"; print $case{'judges'}; print "\n"; #### before: Justice HUDSON did not participate in the consideration or decision of this case. after: this case.SON did not participate in the consideration or decision of