in reply to table into complex data structure

The data structure type depends pretty much on what you want to do with the data. Without details, we can't help you much: there are thousand ways to store the data, but only some of them are beneficial if you want to keep the original order, aggregate by subvalues in given columns, etc.

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: table into complex data structure
by ic23oluk (Sexton) on Oct 31, 2017 at 13:54 UTC
    %data = ( Sample 1 => { actin => 20.514, claudin => 30.544, occludin => 31.183, }, Sample 2 => { actin => 20.416, claudin => 25.611, occludin => 27.831, }, ... );

    this is what i'd like to have at the end :)

      use strict; use warnings; use List::Util qw(reduce); use Data::Dumper; my $hash = reduce { ${ $a->{ $b->[1] } }->{ $b->[2] } = $b->[3]; $a; } {}, grep { @$_ > 3 } map { [ split /\s{2,}/ ] } map { chomp; $_ } <DATA> ; print Dumper( $hash ); __DATA__ 1 Sample 1 actin 20,514 2 Sample 1 claudin 30,544 3 Sample 1 occludin 31,183 25 Sample 1 actin 20,514 26 Sample 1 claudin 30,544 27 Sample 1 occludin 31,183 49 Sample 2 actin 20,416 50 Sample 2 claudin 25,611 51 Sample 2 occludin 27,831 73 Sample 2 actin 20,416 74 Sample 2 claudin 25,611 75 Sample 2 occludin 27,831 97 Sample 3 actin 24,213 98 Sample 3 claudin 32,065 99 Sample 3 occludin 34,556 121 Sample 3 actin 24,213 122 Sample 3 claudin 32,065 123 Sample 3 occludin 34,556 145 Sample 4 actin 20,498 146 Sample 4 claudin 25,365 147 Sample 4 occludin 27,869 169 Sample 4 actin 20,498 170 Sample 4 claudin 25,365 171 Sample 4 occludin 27,869 193 H2O actin 194 H2O claudin 195 H2O occludin 217 H2O actin 218 H2O claudin 219 H2O occludin


      holli

      You can lead your users to water, but alas, you cannot drown them.