use warnings; use strict; while () { s/#sql/sql/ if $. > 2 and $. < 5; print; } __DATA__ #sql #sql #sql #sql #sql #sql #sql