$ticks = time(); .... $ticks = time() - $ticks; print "$count Records updated in $ticks seconds\n"; #### my(%map) = qq( 'AMNT_PAID', '0.0', 'AMOUNT', '{PurchAmt}', 'DELIVERY_NOTE', '"{Delivery}"', 'EXPORTED', 'IF({Exported}, "Y", "N")', 'FUNDS', 'IF("{CompanyID}"="BCU", "USD", "CAD")'); #### # Create a set list from the data and the data map sub makemap { my($map, $r) = @_; my($key, $result, $t, %h, $ndx); %h=%$r; $result=""; foreach $key (sort(keys(%$map))) { #print "$key:\t$map->{$key}\n"; $t = $map->{$key}; # substitute the actual value for the placeholder fieldname $t =~ s/(\{\S+\})/defined(eval("\$h$1")) ? eval("\$h$1") : "NULL"/eg; # replace any double quotes with escaped doubles if ((substr($t,0,1) eq '"') && (length($t) > 2)) { # best 196 sec # $ndx = 1; # while( ($ndx = index($t, '"', $ndx)) != -1 and ++$ndx < length($t)) { # substr($t, $ndx++, 0, '"'); # } # original 198 sec # for ($ndx=1; $ndx < length($t)-1; $ndx++) { # if (substr($t,$ndx,1) eq '"') { # substr($t,$ndx,1) = '""'; # $ndx++; # } # } # substring 204 sec # substr($t, 1, -1) =~ s/"/""/g; # zero width assertion 201 sec $t =~ s/(?<=.)"(?=.)/""/g; } #print "$t\n"; $result .= qq($key=$t ,); } chop($result); # remove trailing , return($result); }