Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2014-10-02 03:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (45 votes), past polls