in reply to how extract and group data in a array

Looks like you want a regular expression to do the work for you. I suggest you take a look at perlretut for a start.

You repeated use of arrays where you should be using scalars (my @dd; instead of my $dd;) suggest you are not very familiar with Perl so you may get some mileage out of reading through perlintro too.

When you have put some code together to try, and if you should happen to have trouble making it work, come back for some guidance.

Update: must be time for glasses! I'm sure I saw qq/.../. Sigh. Disregard the comments above.

Premature optimization is the root of all job security