CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [phamou] Special Extraction requirement... : Edit Log



meloyelo
User

Jun 13, 2008, 11:30 PM


Views: 1521
Re: [phamou] Special Extraction requirement...

Slurp the entire file into a variable. Then you can write a regular expression that spans more than one line:


Code
my $log = ... # contents of the SQL log file 

while ($log =~ m/\{(.*?)\}\s*\{(.*)\}/sg) {
print "execution time: $1\n";
print "sql statement: $2\n";
}

Note the /s on the regular expression.


(This post was edited by meloyelo on Jun 13, 2008, 11:31 PM)


Edit Log:
Post edited by meloyelo (User) on Jun 13, 2008, 11:31 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives