Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: get data from the database -CGI

by moritz (Cardinal)
on Nov 09, 2010 at 12:39 UTC ( #870289=note: print w/ replies, xml ) Need Help??

in reply to parsing a txt file

while (<>) { s/^/X/ if /marker1/.../marker2/; print; }

Or something along those lines. If you describe your problem better, and what you tried, and where you are having problems, I might give you a better answer.

P.S. what does the title of your question has to do with the rest of the question?

Perl 6 - links to (nearly) everything that is Perl 6.
Comment on Re: get data from the database -CGI
Download Code
Replies are listed 'Best First'.
Re^2: get data from the database -CGI
by mjscott2702 (Pilgrim) on Nov 09, 2010 at 15:47 UTC
    I have used the standard "flip-flop" .. operator for similar things, but always had to explicitly exclude the start and end points i.e. marker1 and marker2.

    Does the ... remove the need for this? Is this only for more recent Perl versions (still stuck on 5.8)?

      Why don't you just try it?
      Perl 6 - links to (nearly) everything that is Perl 6.
        Fair enough, so I did, using the following:
        while(<DATA>) { print if (/line1/ ... /line5/); } __DATA__ line1 line2 line3 line4 line5

        Outputs all the lines, including the start and end "markers". So, unless I am doing something wrong, I don't see how this is any different from the .. operator I have used in the past (at least under 5.8)?

        Reason I didn't just try it (which I should have anyway, admittedly) is that I thought myself and others would benefit from a little further explanation.

        Guess it's RTFM time for me...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://870289]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2016-05-01 02:46 GMT
Find Nodes?
    Voting Booth?
    :nehw tseb si esrever ni gnitirW

    Results (441 votes). Check out past polls.