I would probably do something like this to make an array of hashrefs.

#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11160609 use warnings; use List::AllUtils qw( pairwise bundle_by ); my @keys = split /, /, 'Pressure, Geop Height, Temperature, Dew Point, + Humidity, Wind Direction, Wind Speed MS, Wind UMS, Wind VMS, Precipi +tation Amount, Total Cloud Cover, Low Cloud Cover, Medium Cloud Cover +, High Cloud Cover, Radiation Global, Radiation Global Accumulation, +Radiation Net Surface LW Accumulation, Radiation Net Surface SW Accum +ulation, Radiation SW Accumulation, Visibility, Wind Gusts'; my @datasets = bundle_by { +{ pairwise { $a, $b } @keys, @_ } } 21, split ' ', getdata(); use Data::Dump 'dd'; dd @datasets[0 .. 2]; sub getdata { return '1016.1 7.7 20.6 13.8 72.9 215.0 6.64 3.94 5.33 0.0 31.3 31.3 0 +.0 0.0 ... 10727690.0 38242.3 10.8'; }

And here's what the first 3 elements of the answer array are:

( { "Dew Point" => 13.8, "Geop Height" => 7.7, "High Cloud Cover" => "0.0", "Humidity" => 72.9, "Low Cloud Cover" => 31.3, "Medium Cloud Cover" => "0.0", "Precipitation Amount" => "0.0", "Pressure" => 1016.1, "Radiation Global" => 716.7, "Radiation Global Accumulation" => "8461717.0", "Radiation Net Surface LW Accumulation" => "NaN", "Radiation Net Surface SW Accumulation" => "7750386.0", "Radiation SW Accumulation" => "2224256.0", "Temperature" => 20.6, "Total Cloud Cover" => 31.3, "Visibility" => 38507.5, "Wind Direction" => "215.0", "Wind Gusts" => 10.9, "Wind Speed MS" => 6.64, "Wind UMS" => 3.94, "Wind VMS" => 5.33, }, { "Dew Point" => 13.7, "Geop Height" => 7.7, "High Cloud Cover" => "0.0", "Humidity" => 71.1, "Low Cloud Cover" => 2.1, "Medium Cloud Cover" => "0.0", "Precipitation Amount" => "0.0", "Pressure" => 1016.4, "Radiation Global" => 727.6, "Radiation Global Accumulation" => "11081057.0", "Radiation Net Surface LW Accumulation" => "NaN", "Radiation Net Surface SW Accumulation" => "10146792.0", "Radiation SW Accumulation" => 2372829.8, "Temperature" => 21.1, "Total Cloud Cover" => 2.1, "Visibility" => 40682.2, "Wind Direction" => "222.0", "Wind Gusts" => 11.2, "Wind Speed MS" => 6.82, "Wind UMS" => 4.67, "Wind VMS" => 4.95, }, { "Dew Point" => 13.2, "Geop Height" => 7.7, "High Cloud Cover" => "0.0", "Humidity" => 67.7, "Low Cloud Cover" => 0.8, "Medium Cloud Cover" => "0.0", "Precipitation Amount" => "0.0", "Pressure" => 1016.4, "Radiation Global" => 749.9, "Radiation Global Accumulation" => "13780637.0", "Radiation Net Surface LW Accumulation" => "NaN", "Radiation Net Surface SW Accumulation" => "12614863.0", "Radiation SW Accumulation" => 4011495.3, "Temperature" => 21.6, "Total Cloud Cover" => 0.8, "Visibility" => 44407.4, "Wind Direction" => "220.0", "Wind Gusts" => 11.3, "Wind Speed MS" => 6.71, "Wind UMS" => 4.37, "Wind VMS" => 5.1, }, )

In reply to Re^5: Repeating a capture group pattern within a pattern by tybalt89
in thread Repeating a capture group pattern within a pattern by mldvx4

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.