Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 chanting in the Monastery: (6)
As of 2014-12-29 12:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (187 votes), past polls