use warnings; use strict; use LWP::Simple; use DBI; my $data = ''; my $dbh = ''; my $url = 'http://www.perlmonks.org/?node_id=207304'; my $pat = qr{ (.*?)<\/author>.*?(.*?)<\/text> }xs; $dbh = DBI->connect( "dbi:SQLite:dbname=C:\\testdb", "", "" ); $data = get( $url ); while ($data =~ m/$pat/msg) { my ($auth, $text) = ($1, $2); for( $text ) { s/[ ]+/ /g; s/^\s+//; s/\s+$//; } printf "%s: %s\n\n" , $auth , $text; $dbh->do('insert into monks values(?,?)', undef, $auth, $text ); }