123456789101112131415161718192021
#!/usr/bin/perluse strict;use warnings;my $cur = -10;my $x = qr'Begin';my $y = 3;while (<DATA>) { $cur = $. if /$x/; print if ($.>$cur and $.<=$cur+$y);}_ _DATA_ _HelloWelt Begin TestALPHABETAGAMMADELTA