Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

020200001117VUTVS01 00000745B3^V^V^A2^C^D^V^V^A 0000 0001 090104 N S00 +00000000 00001889^B{IT}R
How to delete string before {IT}

Replies are listed 'Best First'.
Re: delete line
by jethro (Monsignor) on Nov 25, 2009 at 09:19 UTC
    $string=~s/.*\{IT\}/{IT}/;
    This works if you are sure that {IT} does not occur afterwards (i.e. in the part you want to keep)
    $string=~s/.*?\{IT\}/{IT}/;
    This works if you are sure that {IT} does not occur in the string before (i.e. in the part you want to throw away)