use strict; my $few = shift || 3; while () { if (/Update certificate/) { print $_; print scalar for 1..$few; } }