This code works, however I get errors when I run it and they reference line 36. I get these Use of uninitialized value in numeric ne (!=) at line 36 of the script. When I take of use strict and use warnings - but we don't want to do that. I have to do something, ligically with line 36. Use strict does not like this line: "if ($spec_hash{$exch}{$symbol} != 1) {"

Use of uninitialized value in numeric ne (!=) at ./pure_penny_golf_wex +tend.forBrodinpl line 36. etds_extend surplus specialist name: delete from etds_extend where e_r +isk_symbol = 'WINN' and e_exch_dest = 'XISX' Use of uninitialized value in numeric ne (!=) at ./pure_penny_golf_wex +tend.forBrodinpl line 36. etds_extend surplus specialist name: delete from etds_extend where e_r +isk_symbol = 'WTR_S5F4' and e_exch_dest = 'XISX'

WINN and WTR_S5F4 are in the %extend_hash

 This is the %extend_hash

$VAR1 = {'6' => {'IACI' => { 'ARCX' => { 'specialist' => '1', 'penny' +=> '0 }}, 'MCHP' => { 'ARCX' => { 'specialist' => '1', 'penny' +=> '0'}}, 'BC' => { 'AMXO' => { 'specialist' => '1', 'penny' +=> '0'}}, 'WINN' => { 'XISX' => { 'specialist' => '1', 'penny' +=> '0'}}, 'WTR_S5F4' => { 'XISX' => { 'specialist' => '1', 'penny' +=> '0'}}, 'XLY' => { 'CS' => { 'specialist' => '0', 'penny' +=> '1'}} } };

this is the spec_hash - WINN and WTR_S5F4 are not in the %spec_hash

$VAR1 = { 'XISX' => { 'FCEL'=> 1, 'GPS' => 1, 'MCO' => 1, 'DPZ' => 1, 'ENTG' => 1, 'PDS' => 1 } };

this is the script.

1 #!/sbcimp/perl/bin/perl 2 #/sbcimp/etds_extend.pl 3 use DBI ; 4 use strict ; 5 use warnings; 6 7 use Data::Dumper; 8 my %extend_hash = (); 9 my $dbUser = 'nice'; 10 my $dbPass = 'try'; 11 my $dbSid = 'THE_world'; 12 my $dbh = DBI->connect("dbi:Oracle:$dbSid","$dbUser","$dbPass") o +r die( "Couldn't connect: $!" ); 13 my $query = "select level_id,e_risk_symbol,e_exch_dest,penny,speci +alist from etds_extend"; 14 if(!$dbh) { 15 print "Error connecting to DataBase; $DBI::errstr\n"; 16 } 17 my $cur_msg = $dbh->prepare($query) or die "\n\nCould not prepare +statement: ".$dbh->errstr; 18 $cur_msg->execute(); 19 while (my @row=$cur_msg->fetchrow_array) { 20 $extend_hash{$row[0]}{$row[1]}{$row[2]}{'penny'}=$row[3]; 21 $extend_hash{$row[0]}{$row[1]}{$row[2]}{'specialist'}= +$row[4]; 22 } 23 my %spec_hash=(); 24 $query = "select e_risk_symbol from gsd_etds where level_name='EXC +H_CS' and e_exch_dest='XISX' and e_symbol_comment in ('Bin_6','Bin_56 +')"; 25 if(!$dbh) { print "Error connecting to DataBase; $DBI::errstr\n"; +} 26 $cur_msg = $dbh->prepare($query) or die "\n\nCould not prepare + statement: ".$dbh->errstr; 27 $cur_msg->execute(); 28 while (my @row=$cur_msg->fetchrow_array) { 29 $spec_hash{'XISX'}{$row[0]}=1; 30 } 31 #print Dumper(\%spec_hash) ; 32 #print Dumper(\%extend_hash) ; 33 foreach my $symbol (sort keys %{$extend_hash{6}}) { 34 foreach my $exch (sort keys %{$extend_hash{6}{$symbol}}) { 35 if ($extend_hash{6}{$symbol}{$exch}{'specialist'}) { 36 if ($spec_hash{$exch}{$symbol} != 1) { 37 my $line="etds_extend surplus specialist name: del +ete from etds_extend where e_risk_symbol = '$symbol' and e_exch_dest += '$ exch'"; 38 print "$line\n"; 39 #push(@error_array,$line); 40 } 41 } 42 } 43 }

In reply to Use of uninitialized value by MrTEE

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.