Hello Monks, I can't figure out what to do with my s/// line below to get rid of the 'uninitialized value in substitution' error that I'm getting. I looked at
this earlier thread for some insight, but can't figure out how to apply it to my case. Anyway, the offending code is:
# initialize @row
my @row;
# for each table row, apply all the regex patterns in order to the tva
+l_test column
open(FILE, "< $file") || die "Can't open regex.txt: $!\n";
while(my $regex=<FILE>){
# get all tval_test columns
my $sql_q = "select tval_test from cas_testbed.rtemp";
my $sthr = $dbh->prepare($sql_q);
$sthr->execute;
my @rex = split(/\s/,$regex);
# work on each tval_test row
while (@row = $sthr->fetchrow_array){
# search for $rex[0] and replace with $rex[1]
s/$rex[0]/$rex[1]/ig;
} # END while (@row = $sth->fetchrow_array)
$sthr->finish;
} # END while(my $regex=<FILE>)
close FILE;
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.