Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^2: How to delete contents between two strings.

by mscharrer (Hermit)
on Sep 17, 2008 at 14:14 UTC ( #712002=note: print w/replies, xml ) Need Help??

in reply to Re: How to delete contents between two strings.
in thread How to delete conetents between two strings.

Uuii, the Range Operator in scalar/boolean mode. I just learned this year about it. Very nice solution, toolic.

In case the Anonymous Monk, or someone else with a similar homework ;-), needs the ** lines included, the feature that '..' in scalar mode returns an increment for every true evaluation and adds 'E0' on the last, can be used:

#!/usr/bin/perl use strict; use warnings; while (<DATA>) { my $i = (/\*\*Temp/ .. /\*\*End/); print unless ($i && $i > 1 && substr($i, -2) ne 'E0'); } __DATA__ first second **Temp** fdvfd fgd dfgd dfgd **End Temp ** this is test dffdgd this is test dffdgd


first second **Temp** **End Temp ** this is test dffdgd this is test dffdgd

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://712002]
holli brings cookies to the meeting
[stonecolddevin]: good morning all
[holli]: I'd bring wine but I am dry since two years, so cookies must do
[1nickt]: james28909 I enjoyed your metaphysical wonderings in tghe scientist thread. Also thought your comment about baby crispr students was comment of the year.
Eily brings the milk

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2017-12-13 17:49 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (373 votes). Check out past polls.