#!/usr/bin/perl use strict; use warnings; # Open the file for reading my $filename = 'example.txt'; # Replace 'example.txt' with your file name open my $file, '<', $filename or die "Could not open $filename: $!"; # Read the entire file content into a scalar variable local $/ = ''; # Set the input record separator to an empty string to read paragraphs my $file_content = <$file>; # Split the file content into paragraphs and store them in an array my @paragraphs = split /\n/, $file_content; # Close the file close $file; # Print each paragraph foreach my $paragraph (@paragraphs) { print "Paragraph:\n$paragraph\n\n"; }