in reply to Re^2: replace all but first
in thread replace all but first
my $seen=0; while(<DATA>) { if ($seen) { s{<cnt>Germany</cnt>}{<TAB>} } else { $seen ||= m{<cnt>Germany</cnt>} } print; } __DATA__ <cnt>Germany</cnt><cmp>ALLIANZ INSURANCE</cmp> <cnt>Germany</cnt><cmp>ALLIANZ PARKWAY</cmp> <cnt>Germany</cnt><cmp>ALLIED DOMECQ</cmp>
|
|---|