in reply to Re: Split up file depending unique values 1st column
in thread Split up file depending unique values 1st column

This works really well! I can't say I didn't expect shorter code. Though it is shorter I'll definitely need to take some time to try to figure out what's going on.
Thanks again, Gert
  • Comment on Re^2: Split up file depending unique values 1st column

Replies are listed 'Best First'.
Re^3: Split up file depending unique values 1st column
by jwkrahn (Abbot) on Dec 17, 2006 at 16:12 UTC
    If you really want shorter code then:
    use warnings; use strict; /^([^,]+)/ && open F, ">>$1" and print F while <>; __END__
    :-) The way it works is that it opens a file in append mode for every line that matches the regular expression using the first field as the file name and prints the current line to the end of that file.

      awesome!
      And with the explanation I even do understand the grammar of this one (line).