read line by line 
Author Message
 read line by line

when i use the following code to get a page which using post
method...however, when i parse the page with
while($page =~ /^.*/mg)
{ if ($& =~ regular expresson) { };
if ($& =~ another regular expresson) { };
...}

it seems that it cannot check $page by line by line....how can I solve it?
thx~

use LWP;
use URI::Escape;
use HTTP::Request::Common;

use constant RFC_SEARCH => ' http://www.*-*-*.com/ ';
use constant RFC_REFERER => ' http://www.*-*-*.com/ ';

$ua = LWP::UserAgent->new;
$newagent = 'search_rfc/1.0 (' . $ua->agent . ')';
$ua->agent($newagent);

$request = POST (RFC_SEARCH,
                   Content => [ keyword => $Search],
                   );

$response = $ua->request($request);
die $response->message unless $response->is_success;

$page = $response->content;
..........



Tue, 21 Sep 2004 12:11:08 GMT  
 read line by line

Quote:

> Subject: read line by line

Note that your question is NOT about reading line by line.

Quote:
>while($page =~ /^.*/mg)

It appears that your question really is:

   How to split a multiline string?

And the answer would be:

   foreach my $line ( split /\n/, $page ) {

--
    Tad McClellan                          SGML consulting

    Fort Worth, Texas



Tue, 21 Sep 2004 14:39:18 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. read last line without reading previous lines, how?

2. how to read in line by line?

3. Limiting maximum line length during line based read

4. read line by line in perl

5. how to read in line by line?

6. How do I read line by line of data from a file using perl

7. how to read a huge file line by line without loading it into memory

8. reading lines from one file and pulling matching lines in another

9. newbie perl question - reading a file line by line

10. Line by line file reading

11. How to read a file line by line w/loop

12. Read remote text file line by line

 

 
Powered by phpBB® Forum Software