in reply to Re: Read in a file containing the criteria for a program when it runs
in thread Read in a file containing the criteria for a program when it runs

This method is also great. I know that I can print any specific clump of data. Ex.  print Dumper \@filter[0] to get the first clump of data in the array. My question is, can I (and if I can, how can I) pull out the individual elements in the array. Ex.

$VAR1 = \[ '1000_Genomes', '<=', '0.03', 'filter ', ' '1 ];
is the output I get when I print  Dumper \@filter[0] . I need to be able to use each individual element (1000_Genomes, <=, 0.03, etc..) separately throughout my program. Should I store these values in variables or what? Thanks for your assistance!!!!

Replies are listed 'Best First'.
Re^3: Read in a file containing the criteria for a program when it runs
by aitap (Curate) on Jul 18, 2012 at 18:59 UTC

    You can access elements by their nubmers. For example, print $filter[0]->[0],"\n" should print 1000_Genomes.

    -> is necessary because @filter array contents are not real arrays, but references to arrays.

    Sorry if my advice was wrong.

      Would it be safe to use references to arrays in a program that will eventually sort through a TON of data? Also, through using references to array, I should be able to call on the individual elements when running my code, correct? Thank you so much. You have really helped me out!

        If file is corrupted, split /\t/,$_ will return something else and some of the array elements may eventually become undefined. Perl will throw a warning if you use warnings when you try to do something with such elements. You may want to check elements using defined, but this can slow down your program.

        When you are working with TONS of data, it can be useful to try SQL (sqlite, for example).

        Yes, you will be able to access all of your data using array references. Data::Dumper and x command in debugger are useful when you have troubles with acessing some data strictures in Perl.

        Sorry if my advice was wrong.