Hello all, I am stumped and need some assistance. My code:

#variables my $x=0; my @keys; my @holder; my @array_hash; my $blank = "-"; my $numerical_value = "num"; my $string_value = "string"; my $filter = "filter"; my $append = "append"; for(my $c = 0; $c <= $num_elements; $c++) { if('$hash{$filter[$c]->[4]}' eq '$filter') { if (exists($hash{$filter[$c]->[0]})) { print "VALUE EXISTS", "\n"; # continue; if('$hash{$filter[$c]->[3]}' eq '$numerical_value') { #process filtering for numerical value if ((eval "$hash{$filter[$c]->[0]} $filter[$c]->[1 +] $filter[$c]->[2]")) { print OUTFILE $line, "\n"; } } if('$hash{$filter[$c]->[3]}' eq '$string_value') { #process filtering for string value if ((eval "'$hash{$filter[$c]->[0]}' $filter[$c]-> +[1] '$filter[$c]->[2]'")) { print OUTFILE $line, "\n"; } } } else { print "COLUMN NAME DOES NOT EXIST. CHECK FILTER FILE F +OR ANY POSSIBLE ERRORS AND RE-RUN PROGRAM. PROGRAM WILL NOW TERMINATE +.", "\n"; exit 0; } }

I am using a for loop to iterate through the entirety of the array I create when reading in from an input file. As long as  $c is less than or eq to the number of elements in the array -- if the hash of the column name is equal to "filter", continue -- if the hash of the column name exists, continue (else display error and terminate program) -- if the hash of the column name equals 'num' or 'string' (respectively), continue -- if the hash of the column name evaluates as true, print to OUTPUT file.

However, no output is printed to my OUTFILE (note: this is only part of my code, the other part of code relates to storing the information from a filter file and input file. It has been tested and works so I know the problem lays in the above mentioned code. Please help!! Thank you!

Here is the input file so you can make sense of what is stored in the array and what is going on in the eval statement

column relationship value num_or_string filter_or_append order a <= 0.3 num filter 1 b = abc string append 3 c <= 0.3 num filter 2

Note  if ((eval "'$hash{$filter[$c]->[0]}' $filter[$c]->[1] '$filter[$c]->[2]'")) translates to -- if column a <= 0.3 -- print OUTFILE line.


In reply to No output to screen or output file by dkhalfe

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.