in reply to Using a regex to catch interpreters

assuming you have your file in an array  @test(for example purposes) you could do someting pretty simple:
my $end = @test; my $cnt = 0; until ($cnt == $end) if (($test[$cnt] =~ /^>>>\s/) && ($test[$cnt+1] !~ /^>>\s/)){ $tst[$cnt] =~ s/^>>>/PYTHON_PROMPT/; } $cnt++; }