------------------------------------------------ On Fri, 7 Mar 2003 16:42:39 +0000, [EMAIL PROTECTED] wrote:
> Hi all > > perl script below works, and does what I hoped it would, but I don't seem > to understand how to get it to print out the result to a new file as > opposed to stdout. > > Thanks for any help > > #!/usr/bin/perl -w > use strict; > use HTML::Parser; > > open(OUT, ">/share/file1") || die "Cannot open /share/file1: $!\n"; > > my $html = HTML::Parser->new( > api_version => 3, > text_h => [sub{ print shift;}, 'dtext'], > start_h => [sub{ print shift;}, 'text'], > end_h => [sub{ print shift;}, 'text']); > > $html->ignore_tags(qw(!? table body span img p br hr td tr font i b h1 a)); > $html->parse_file("/share/input.txt"); > $html->eof; > > close(OUT); > Alternatively to what the others posted, you could use the 'select' function, to select OUT as the default file handle. Check out: perldoc -f select Remember to put it back the way it was when you are done. Although I would just change your sub definitions like the others mentioned, but TMTOWTDI... http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]