in reply to matching paragraphs

imhotep,
Take a closer look at perldoc perlvar. To turn on "paragraph mode" in Perl, set $/ = "" not undef. Unfortunately, the rest of your post isn't very coherent (to me anyway), but the following might be what you want:
open (INPUT, '<', $file) or die $!; { local $/ = ""; while ( <INPUT> ) { print '<p>', $_, '</p>'; } }

Cheers - L~R