in reply to Re: Restarting counters in text
in thread Restarting counters in text

Hi Further to the above comments. Here is the code that might work for you.
$_ =~ s/<exm>/'<exm num="'.$exmno++.'">'/egs; if ($_ !~ /^<exm.*?$/) { $exmno=0; }
Refer for the syntax rules before any thing fails :-) -Dinakar

Edited - Added code tags (davorg)

Replies are listed 'Best First'.
Re^3: Restarting counters in text
by davorg (Chancellor) on Aug 10, 2006 at 11:39 UTC

    Please use <code> tags to make your code easier to read.

    if ($_ !~ /^<exm.*?$/)

    The ".*?$" on the end of that regex is pointless.

    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

      Opps It was redundant. I agree . Thanks for spotting :) Dinakar