in reply to Re: select from mysql table based on two column match
in thread select from mysql table based on two column match

"If that is what you are looking for here you go, Untested though!"

Some comments:

#!/usr/bin/perl -w use strict; use warnings;

You have use warnings; and perl -w, both activate warnings.

#Get first input print "Enter cpt code> "; my $cptcode = <STDIN>;

You're not chomping user input.

my $sth = $dbh->prepare('SELECT * FROM charge WHERE column1 = $cptcode + AND column2 = $cpt2code’)

This is dangerous. See SQL_injection/Bobby Tables. Use placeholders and bind variables.

Replies are listed 'Best First'.
Re^3: select from mysql table based on two column match
by afoken (Chancellor) on Jan 26, 2017 at 20:15 UTC
    You have use warnings; and perl -w, both activate warnings.

    But the effects of use warnings; and perl -w are slightly different, this is explained in detail in warnings. Rule of thumb: perl -w enables warnings globally (bad), whereas use warnings; enables warnings only per file or block (good).

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)