your first three points on security are absolutely correct. however, after reading on prepare_cached(), i don't think that's my solution. maybe i'm wrong, but it just doesn't seem much more secure to me than prepare(). and i think that doing further checking on my input and a sanity check on the final query, that i be much better. in fact, since you brought it up, i found this great node here that has tons of pointers:

http://www.perlmonks.org/?node_id=756058

and this discussion on sql injection

http://unixwiz.net/techtips/sql-injection.html

however, i think the first thing i'm going to be reading is the 'perlsec' doc mentioned at the top of that pm node. as for my code, i finally figured out how to make it more readable and usable.

since i'm wanting items based on each word (which lines a word is in and which strings from sql a word returns) i use %data{ $word } and put all associated data on that.

it's late, so this has issues that i need fixing, but my general idea is:

while ( my $fields = $sth->fetchrow_arrayref ) { foreach my $field (@fields) { definition( $line, $word, $field ); } } } $dbh->disconnect; for my $word ( keys %data ) { while( my ($field, $type) = each %{ $data }{ $word } ) { print "$word,$field" if( $type eq 'field' ); while( my ($line, $type) = each %{ $data }{ $word } ) +{ print ",$line" if( $type eq 'line' ); } } } sub definition { my ($line, $word, $field) = @_; if( defined( $field ) { if( !defined( $data{ $word }{ $field } ) ) { $data{ $word }{ $field} = field; } $data{ $word }{ $line } = line; } }

In reply to Re^4: error joining hashref of an arrayref by ag4ve
in thread error joining hashref of an arrayref by ag4ve

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.