Dan Fish wrote:
Is there an easy way to pipe output to an external perl routine and
then pipe the output of that routine back in for more processing?

It depends on what the external Perl routine does.

In particular I want to use LWP::UserAgent to grab a web page, pipe
the output to Tom Christiansen's "striphtml" routine
(http://www.cpan.org/authors/Tom_Christiansen/scripts/striphtml.gz)
and then pipe that output back in for some subsequent processing.

The striphtml program only consists of a few substitutions, so you need to assign the page that is to be processed to $_. This is one way to make use of the program:

    sub striphtml {
        local $_ = shift;
        do 'striphtml.pl';
        $_
    }

    $page = striphtml($page);

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

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




Reply via email to