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

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

by kennethk (Abbot)
on Apr 17, 2017 at 21:43 UTC ( [id://1188177]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    use strict;
    ...
    TEST =>
    
    # And ignoring this
    
  2. or download this
    my $fileContent;
    open(my $fileHandler, $inputFile) or die "Could not open file '$inputF
    +ile' $!";
    ...
        $fileContent = <$fileHandler>;
    }
    close($fileHandler);
    
  3. or download this
    my $fileContent = do {
        open(my $fileHandler, $inputFile) or die "Could not open file '$in
    +putFile' $!";
        local $/;
        <$fileHandler>;
    };
    
  4. or download this
    if($fileContent =~ /\b\Q$beginString\E\b(.*?)\b\Q$endString\E\b/s){
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (1)
As of 2024-04-25 01:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found