I have been trying to read some data from a web using LWP::UserAgent and this is what i have tried so far.
when i print using dumper (as per suggestions in CB)i am able to print the content but when itry to open using file handler it gives me an error as nosuch file or directory Can you please advise on how do i process on each line of $request. when i print $request using dumper it prints HTML format as below and i need to extract only the names can i have regex also please.use Data::Dumper; require LWP::UserAgent; require HTTP::Request; my $request = HTTP::Request->new(GET => 'http://pilot/sanju/index.php/ +empdata'); my $ua = LWP::UserAgent->new; my $response = $ua->request($request); unless($response->is_success) { die 'Cannot connect to remote address' +; } my $cmd = $response->content; # print Dumper \$response; open (FILE, "<" , \$cmd ) or die $! ; while (<FILE>){ chomp; print $_; }
<td> 1 </td><td>engg </td><td> staff </td><td> ruslion,marry</td></ +tr> <tr> <td> 2 </td><td>accounts </td><td> operational </td><td> tom, +harry </td></tr> <tr><td> 3 </td><td>HR </td><td> support </td><td> john, +wirth
In reply to Help on getting data from LWP::UserAgent by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |