G'day leoberbert,
" I need a help ..."
It would appear you actually need lots of help, not a help.
Here's lots of help:
-
"How do I post a question effectively?" (surprisingly, as you joined almost four years ago and have made several posts in that period).
-
"How (Not) To Ask A Question"
(paying particular attention to the "Do Your Own Work" section).
-
"perlintro — Perl introduction for beginners"
(this is peppered with links to more detailed and advanced information: follow as needed).
-
Text::CSV with "sep_char => '|'",
if your data is in a pipe-separated format;
split with "/[|]{3}/",
if "|||" is just a constant literal used as a delimiter.
-
You should probably consider capturing all your input in a hash;
leaving collation and output to a subsequent stage.
The key would appear to be that initial, numeric field.
-
You may also want join
and sort in various places.