Tham, Philip wrote: > Hi > > I am using LWP to send an HTTP Get and I receive the http response in > a variable which I named resp. > > I would like to process the string resp->content token by token and > modify the output. > > I see that HTML::TokeParser allows for this kind of processing but I > have to read the input from a file. However in my case I have the > entire hmtl response in a string. > > What library should I use for this purpose.
>From the HTML::TokeParser docs: $p = HTML::TokeParser->new( $filename ); $p = HTML::TokeParser->new( $filehandle ); $p = HTML::TokeParser->new( \$document ); The object constructor argument is either a file name, a file handle object, or the complete document to be parsed. If the argument is a plain scalar, then it is taken as the name of a file to be opened and parsed. If the file can't be opened for reading, then the constructor will return undef and $! will tell you why it failed. If the argument is a reference to a plain scalar, then this scalar is taken to be the literal document to parse. The value of this scalar should not be changed before all tokens have been extracted. Note the the last form. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>