in reply to Re^3: print() on closed filehandle WRITE_FH
in thread print() on closed filehandle WRITE_FH

Hi haukex, I was ale to get it to work by using OUT:

#Parse html file using TreeBuilder Module use strict; use warnings; use HTML::TreeBuilder 3; #Open text file to redirect treebuilder output to file open OUT, '>', $treefile or die "cannot open $treefile for writing ; $!"; my $root = HTML::TreeBuilder->new; $root->parse_file($htmlfile) or die "could not open $htmlfile for pars +ing\n"; my @div_class = $root->find_by_attribute("class","forminput"); foreach my $node (@div_class) { print OUT $node->content_list(); print OUT "\n"; } close OUT;

As far as just copying and pasting sometimes I an up against time constraints so I don't always have the time to fully understand the code and end up going back later to look at the code more closely which I will do with what you have provided for me here

Replies are listed 'Best First'.
Re^5: print() on closed filehandle WRITE_FH
by Your Mother (Archbishop) on Oct 01, 2018 at 13:23 UTC

    It’s great that you got it working. I caution against thinking this way: …I don't always have the time to fully understand…

    It is as likely—likelihood increasing with code size and complexity—to be false economy as it is to be true.