in reply to Re^6: Parsing Large XML
in thread Parsing Large XML
"I know how to use the open function, but don't know how I would use it here."
Clearly you don't because you still maing the same mistakes. You aren't checking for errors opening files, I've mentioned this three times already:
Re: XML::Twig Help Re^3: XML::Twig Help Re^5: Parsing Large XMLThe open documentation explains the difference between opening for writing and appending. You also shouldn't be opening the file for each print. See also How come when I open a file read-write it wipes it out? from perlfaq5. A short example:
#!/usr/bin/perl use strict; use warnings; my @input = qw( a b c d ); open(my $fh, '>', "output.txt") or die "cannot open input file $!"; foreach(@input){ print $fh "$_ \n"; } close($fh);
|
|---|