in reply to replace at the begining

Another simple solution could be (without using look-behind)
s/<?(p\s+class=)/<$1/;
Regards,
Ashish

Replies are listed 'Best First'.
Re^2: replace at the begining
by Anonymous Monk on Aug 20, 2009 at 15:37 UTC
    #!/usr/bin/perl while(<DATA>){ s/(?<!<)p\sclass=/<p class=/; print $_; } __DATA__ <p class="Hi">Hello <p class="new">How r u
    The above output should look like
    <p class="Hi"\>Hello <p class="new"\>How r u