This is a separate post with a program to use the DB from the previous post.
You could make a Perl hash table to calculate a histogram of say the State1 column. However we can just ask SQL to do that for us and give us the results in descending order of frequency. The DB will figure out how to do this within the memory that it has to work with.

My "SQL kung-foo" is not very advanced, but some really amazing things can be done with SQL when coded by an expert.

use strict; use warnings; use DBI; ############ # let's say you want a histogram of State1 ############ my $dbfilename = "biohisham.sqlite"; my %attr = ( RaiseError => 1); #auto die with error printout my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfilename","","",\%attr) or die "Couldn't connect to database $dbfilename: " . DBI->errstr; my $get_state1_histo = $dbh->prepare("SELECT count(*),State1 FROM bioham GROUP BY State1 ORDER BY count(*) DESC"); $get_state1_histo->execute(); my $array_ref = $get_state1_histo->fetchall_arrayref; foreach my $row_ref (@$array_ref) { print "@$row_ref\n"; } __END__ 12 VEGF -- IL_8 -- Ang_2 -- TSP1_2 -- Maspin -- Invasiveness_migration + -- Senescence -- Glut1_4 -- P21 -- BCL_XL -- LDHA -- Permeability_le +akiness -- Enolase_1 -- S6k1 -- Hmox -- TWIST1 -- Erythropoietin 6 VEGF -- IL_8 -- Ang_2 -- TSP1_2 -- Invasiveness_migration -- Senesce +nce -- Glut1_4 -- P21 -- BCL_XL -- LDHA -- Permeability_leakiness -- +Enolase_1 -- S6k1 -- Hmox -- TWIST1 -- Erythropoietin 4 VEGF -- IL_8 -- Ang_2 -- Maspin -- Invasiveness_migration -- Senesce +nce -- Glut1_4 -- P21 -- BCL_XL -- LDHA -- Enolase_1 -- S6k1 -- Hmox +-- TWIST1 -- Erythropoietin 3 VEGF -- IL_8 -- Ang_2 -- TSP1_2 -- Maspin -- Invasiveness_migration +-- Senescence -- Glut1_4 -- P21 -- BCL_XL -- LDHA -- Permeability_lea +kiness -- Enolase_1 -- Hmox -- TWIST1 -- Erythropoietin 3 VEGF -- IL_8 -- Maspin -- Invasiveness_migration -- Senescence -- Gl +ut1_4 -- P21 -- BCL_XL -- LDHA -- Enolase_1 -- Hmox -- TWIST1 -- Eryt +hropoietin 2 VEGF -- Ang_2 -- TSP1_2 -- Maspin -- Invasiveness_migration -- Senes +cence -- Glut1_4 -- P21 -- BCL_XL -- LDHA -- Permeability_leakiness - +- Enolase_1 -- S6k1 -- Hmox -- TWIST1 -- Erythropoietin 2 VEGF -- IL_8 -- Ang_2 -- TSP1_2 -- Maspin -- Senescence -- Glut1_4 - +- P21 -- BCL_XL -- LDHA -- Permeability_leakiness -- Enolase_1 -- S6k +1 -- Hmox -- TWIST1 -- Erythropoietin 1 Ang_2 -- Maspin -- Invasiveness_migration -- Senescence -- Glut1_4 - +- P21 -- BCL_XL -- LDHA -- TWIST1 -- Erythropoietin 1 IL_8 -- Ang_2 -- Invasiveness_migration -- Senescence -- Glut1_4 -- +P21 -- BCL_XL -- LDHA -- Enolase_1 -- TWIST1 -- Erythropoietin 1 IL_8 -- Ang_2 -- TSP1_2 -- Glut1_4 -- LDHA -- Permeability_leakiness + -- S6k1 1 IL_8 -- Maspin -- Glut1_4 -- P21 -- LDHA -- S6k1 -- Hmox -- TWIST1 - +- Erythropoietin 1 Invasiveness_migration -- Senescence -- Glut1_4 -- P21 -- BCL_XL -- +Ang_1 1 TSP1_2 -- Invasiveness_migration -- Senescence -- Glut1_4 -- BCL_XL +-- Permeability_leakiness -- Enolase_1 -- Ang_1 -- Erythropoietin 1 TSP1_2 -- Senescence -- Glut1_4 -- BCL_XL -- Enolase_1 -- Ang_1 -- T +WIST1 -- Erythropoietin 1 VEGF -- Ang_2 -- Invasiveness_migration -- Senescence -- Glut1_4 -- +Enolase_1 -- Hmox -- Erythropoietin 1 VEGF -- Ang_2 -- Maspin -- Glut1_4 -- P21 -- BCL_XL -- LDHA -- Enola +se_1 -- S6k1 -- Hmox -- TWIST1 -- Erythropoietin 1 VEGF -- Ang_2 -- TSP1_2 -- Invasiveness_migration -- Senescence -- G +lut1_4 -- P21 -- BCL_XL -- LDHA -- Permeability_leakiness -- Enolase_ +1 -- S6k1 -- Hmox -- TWIST1 -- Erythropoietin 1 VEGF -- Ang_2 -- TSP1_2 -- Senescence -- Glut1_4 -- LDHA -- Enolase_ +1 -- Ang_1 -- S6k1 -- Hmox 1 VEGF -- Ang_2 -- TSP1_2 -- Senescence -- Glut1_4 -- P21 -- BCL_XL -- + LDHA -- Permeability_leakiness -- Enolase_1 -- S6k1 -- Hmox -- TWIST +1 -- Erythropoietin 1 VEGF -- IL_8 -- Ang_2 -- Invasiveness_migration -- Senescence -- Glu +t1_4 -- P21 -- BCL_XL -- LDHA -- Permeability_leakiness -- Enolase_1 +-- S6k1 -- Hmox -- TWIST1 -- Erythropoietin 1 VEGF -- IL_8 -- Ang_2 -- Maspin -- Invasiveness_migration -- Senesce +nce -- Glut1_4 -- P21 -- BCL_XL -- LDHA -- Enolase_1 -- Hmox -- TWIST +1 -- Erythropoietin 1 VEGF -- IL_8 -- Ang_2 -- Maspin -- Senescence -- Glut1_4 -- P21 -- B +CL_XL -- LDHA -- Enolase_1 -- S6k1 -- Hmox -- TWIST1 -- Erythropoieti +n 1 VEGF -- IL_8 -- Ang_2 -- TSP1_2 -- Invasiveness_migration -- Glut1_4 + -- P21 -- BCL_XL -- LDHA -- Permeability_leakiness -- Enolase_1 -- S +6k1 -- Hmox -- TWIST1 -- Erythropoietin 1 VEGF -- IL_8 -- Ang_2 -- TSP1_2 -- Maspin -- Glut1_4 -- P21 -- BCL_X +L -- LDHA -- Permeability_leakiness -- Enolase_1 -- S6k1 -- Hmox -- T +WIST1 -- Erythropoietin 1 VEGF -- IL_8 -- Maspin -- Invasiveness_migration -- Senescence -- Gl +ut1_4 -- P21 -- BCL_XL -- LDHA -- Permeability_leakiness -- Enolase_1 + -- Hmox -- TWIST1 -- Erythropoietin 1 VEGF -- IL_8 -- TSP1_2 -- Maspin -- Invasiveness_migration -- Senesc +ence -- Glut1_4 -- P21 -- BCL_XL -- LDHA -- Permeability_leakiness -- + Enolase_1 -- S6k1 -- Hmox -- TWIST1 -- Erythropoietin 1 VEGF -- Maspin -- Glut1_4 -- P21 -- BCL_XL -- LDHA -- Enolase_1 -- S +6k1 -- Hmox -- TWIST1 -- Erythropoietin 1 VEGF -- Maspin -- Invasiveness_migration -- Glut1_4 -- P21 -- BCL_XL + -- LDHA -- Ang_1 -- S6k1 -- Hmox -- TWIST1 -- Erythropoietin 1 VEGF -- TSP1_2 -- Invasiveness_migration -- Senescence -- Glut1_4 -- + P21 -- BCL_XL -- LDHA -- Permeability_leakiness -- Ang_1 1 VEGF -- TSP1_2 -- Maspin -- Invasiveness_migration -- Senescence -- +Glut1_4 -- P21 -- BCL_XL -- Permeability_leakiness -- Ang_1

In reply to Re^5: MCE: How to access variables globally by Marshall
in thread MCE: How to access variables globally by biohisham

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.