in reply to Quoting in DBI sql query for on the fly query

Use placeholders. Not only does it solve your quoting problem, but it prevents nearly every SQL injection attack known to man.
my $sth = $dbh->prepare( <<__END_SQL__ ); SELECT Table1.Name ,Table1.Address ,Table1.City ,Table1.State ,Table1.ZIP ,Table1.Phone FROM Table1 WHERE Table1.BusType = ? __END_SQL__ foreach my $line ( @lines ) { $sth->execute( $line ); # Do whatever you wanted with the executed statement, like fetch() $sth->finish; }

Try it out before you discard it. This is how DBI is supposed to be used.

Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.