On 2020-01-13 21:02, Aureliano Guedes wrote:
ToddAndMargo, this should handle any kind of columns separated data (or any table). If some column (commonly separated with a constant character as "\t", ";", "|", ....)  has different types (char, text, int, boolean, ...) in a single column, then it should be treated as a character, but if it has only float (in all rows/lines) then the parser checks all rows for a same column (in this example case all them are float) and assign the column as float contain column.
Example:

    NAME(long char);NICK(char);AGE(natural/positive
    integer);HEIGHT(float m);WEIGHT(float kg)

    John Lovegood;JoL;23;1.80;85.283

    Marry Lockheart;Marry_L;35;1.68;63,125

You may see that the first line must be a header, all lines have 5 fields separated by ";" and each field has a unique type (the specifications not aways be declared on the data or file).




Consider an array of hashes:

my Str  $Name;
my Str  $NickName;
my uint $Age;
my num  $Height;
my num  $Weight;
my      @Members;

my %Person= ( Name=> $Name, NickName => $NickName, Age=> $Age, Height=> $Height, Weight=> $Weight );

Then you can use "push" to create an array of hashes on to @Members as you read in each member.

push @Members, %Person;

Reply via email to