#!/usr/bin/env perl use 5.010; use warnings; use strict; while(){ print; # print the line if(/banana/){ # if it contained banana print scalar for 1..3; # print the next three lines print "This line was added.\n"; # then add the new line } } # then print the rest of the lines __DATA__ a is for apple b is for banana c is for cantaloupe d is for dill e is for elderberry f is for fennel g is for grapefruit h is for honeydew