in reply to Re: create separate output files based on the matched values
in thread create separate output files based on the matched values

What if I want to put a header line for each of the
generated files?

What's the best way to do this using this script?

Thanks for the help!

  • Comment on Re^2: create separate output files based on the matched values

Replies are listed 'Best First'.
Re^3: create separate output files based on the matched values
by GrandFather (Saint) on Nov 10, 2005 at 19:22 UTC

    Change:

    open $files{$name}, '>', "$name.out" if (! defined $files{$name});

    to

    if (! defined $files{$name}) { open $files{$name}, '>', "$name.out"; syswrite $files{$name}, "This is a header line for file $name.out\ +r\n"; }

    Perl is Huffman encoded by design.