Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: Perl reading in a file and getting a string in between two strings on different lines

by victorz22 (Sexton)
on Apr 17, 2017 at 21:32 UTC ( [id://1188176]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Perl reading in a file and getting a string in between two strings on different lines
in thread Perl reading in a file and getting a string in between two strings on different lines

That didn't work the output i got was just the whole file, i even tried to put an 's' at the end of it for many lines but that didn't work either.

  • Comment on Re^3: Perl reading in a file and getting a string in between two strings on different lines

Replies are listed 'Best First'.
Re^4: Perl reading in a file and getting a string in between two strings on different lines
by LanX (Saint) on Apr 17, 2017 at 21:56 UTC
    Show input that doesn't work! See SSCCE

    That's a classic, most likely you are doing it wrong.

    The only possibility top make it foolproof is to quote regex metacharacters and to anchor the line's start with ^

    print if /^\Q$beginString/ .. /^\Q$endString/;

    See quotemeta

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-04-23 18:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found