It worked fine.

Thanks everybody and especially Yaron and Mathew.

Regards,
Michael

--- [EMAIL PROTECTED] wrote:

> Date: Wed, 9 May 2007 10:00:50 -0400 (EDT)
> From: [EMAIL PROTECTED]
> To: Michael Goopta <[EMAIL PROTECTED]>
> CC: Perl Help <beginners@perl.org>
> Subject: Re: How to return actual string rather than the
> address to the
>  result string
> 
> Hi,
> 
> The parse method returns the parser object reference, and this
> is not your intetion.
> To solve you can use the following:
> 
> local $text = "";
> my $m="";
> sub text_handler() { $text .= shift;}   # Ordinary text
> #   text_handler($z);
>    
>    my $p = HTML::Parser->new();
>    $p->handler( text => \&text_handler, "dtext");
>    $p->parse($z);
>    print $text;
> 
> 
> 
> Yaron Kahanovitch
> ----- Original Message -----
> From: "Michael Goopta" <[EMAIL PROTECTED]>
> To: "Perl Help" <beginners@perl.org>
> Sent: Wednesday, May 9, 2007 4:32:04 PM (GMT+0200)
> Auto-Detected
> Subject: How to return actual string rather than the address
> to the result string
> 
> Hi All,
> 
> I have this little program which cleans strings of HTML tags.
> 
> Currently the subroutine text_handler is returning the address
> of the resultant string back. How can I make it return the
> actual string.
> Any help is appreciated.
> Mick
> 
> my $z= ' <table border=2 cellpadding=4
> cellspacing=0><tr><td><font face="CLRecordTechno" size=1
> color="#000000"><p align="center">No Haledon <br>Great Oppty -
> <br>fixer upper <br>Needs TLC but has great potential. 5 BT, 3
> bths, large large rooms. Great yard with pond. Wonderful area,
> good schools. $399,000<br>Call Owner Now, wont last <br>
> 845-986-5154</font></td></tr></table>';
> 
>  my $m='';
>   sub text_handler() { return @_;}   # Ordinary text
> #   text_handler($z);
>    
>    my $p = HTML::Parser->new();
>    $p->handler( text => \&text_handler, "dtext");
>    $m = $p->parse($z);
>    print $m;
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
> 
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
> 
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to