in reply to can u suggest a regex for this ?
also flip-flop can be used (look for the scalar context usage):
use strict; use warnings; while (<DATA>){ print /^cat/ .. /^\^cat/ ? "#$_" : $_; } __DATA__ mouse cat 1 2 3 ^cat deer eel cat furbaby elk ^cat dog fish
L*
PS ^\^ is actually a cat :)
PPS overlooked previous answer was already using flip-flop.. let rephrase: you can also use flip-flop directly :)
|
|---|