Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Answer: Apply regex to entire file, not just individual lines ?

( #14546=categorized answer: print w/ replies, xml ) Need Help??

Q&A > regular expressions > Apply regex to entire file, not just individual lines ? contributed by juahonen

After you've opened and read the file (or web page) into an array, join all lines with join().
open(FILE, "$filename");
@lines = <FILE>;
close(FILE);

$content = join('', @lines);
After this, $content will be single-line and it is easy to do regexp with your existing functions.

Comment on Answer: Apply regex to entire file, not just individual lines ?
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2014-09-22 06:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (182 votes), past polls