I've been looking for a way to resort&rearrange hundreds of lines from a file, and then save the result in three of more files.
Im new to perl and i havent managed to produce a bigger script like this with guides.
The conversion goes like this;

First i get the raw list which formatting i cannot change directly:
- The first number is the category of the user - these could be sorted to multiple files, 1's in 1.txt and 2's in 2.txt and so on )
1 Förenäme1 Surname1 passwd1 1 Forename2 Surnäme2 passwd2 2 Forenäme3 Surname3 passwd3 3 Forename4 Surname4 passwd4
These are meant to be converted to a list like this:
- The first |-delimited field is in lovercase and ä,å->a, ö->o
- Other copied values are like in the unprocessed file
- Text-contents of FOO BAR and BAZ can be configured in the start of the process
forename1 surname1|passwd1|Förenäme1 Surname1|FOO|BAR|BAZ|FOO Förenäme +1 Surname1
Hope somebody could give me a push to the right direction. Thanks in advance.

Update:
Thank's Fizbin for your diligence! Works like a charm.
Started to expand this forward...

In reply to A bit more complex resorting by melun

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.