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

Re^3: get data from the database -CGI

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

in reply to Re^2: get data from the database -CGI
in thread parsing a txt file

Why don't you just try it?
Perl 6 - links to (nearly) everything that is Perl 6.

Replies are listed 'Best First'.
Re^4: get data from the database -CGI
by mjscott2702 (Pilgrim) on Nov 10, 2010 at 09:19 UTC
    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...

      OK, from perlop:

      If you don't want it to test the right operand till the next evaluation, as in sed, just use three dots ("...") instead of two. In all other regards, "..." behaves just like ".." does.

      Not really sure what the difference is, so I'll stick with my normal two dot approach.

        This is the difference:
        $ yes | nl | perl -ne 'print if /00/../0/' | head -n20 100 y 200 y 300 y 400 y 500 y 600 y 700 y 800 y 900 y 1000 y 1001 y 1002 y 1003 y 1004 y 1005 y 1006 y 1007 y 1008 y 1009 y 1100 y $ yes | nl | perl -ne 'print if /00/.../0/' | head -n20 100 y 101 y 200 y 201 y 300 y 301 y 400 y 401 y 500 y 501 y 600 y 601 y 700 y 701 y 800 y 801 y 900 y 901 y 1000 y 1001 y

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://870371]
[stevieb]: I'm learning that no matter how good a piece of software is at what it's supposed to do, it's a piece of shit without providing any API documentation. (Talking about C++ here currently). Seriously... write software for an embedded platform and make...
[stevieb]: guess based on the sparse examples, and the header files that are spread out illogically?
[stevieb]: document the public facing functions/methods people... ALL OF THEM.

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2017-05-28 23:45 GMT
Find Nodes?
    Voting Booth?