hi all, I'm new there, I'm just playing with perl and lwp and I just successfully created a script for log in to a web site with post. I have a response but I would like to have something like this:
I have in my response lines like:
<div class="sender">mimi020</div>
<some html code.....>
<div class="sender">jane01</div>
..and so on
so 1. search for every "sender" word
2. print
"mimi020"
"jane01"
while (<>) { # reads STDIN, put a different handle here if you want
if (/<div class="sender">(.*)<\/div>$/) {
print "\"$1\"\n"; # prints with " symbols
print "$1\n"; # prints without " symbols
}
}
hi, thank you for your answer but I'm not sure how to use it,
is this ok?
while ($response2->content()) { # reads STDIN, put a different handle here if you want
if (/<div class="sender">(.*)<\/div>$/) {
print "\"$1\"\n"; # prints with " symbols
print "$1\n"; # prints without " symbols
}
}
it gives me an (infinity?) errors
Use of uninitialized value $_ in pattern match (m//) at p2.pl line 103, <> line 1.
so what am I doing wrong?
---------- Post updated 08-05-12 at 10:46 AM ---------- Previous update was 08-04-12 at 02:37 PM ----------
ok I got it:
my $html = $response2->content;
while( $html =~ m/<div class="sender">(.*)<\/div>/g) {
# print "\"$1\"\n"; # prints with " symbols
print "$1\n"; # prints without " symbols
}