Dear monks
I come with a question, seeking knowledge :), I being working
with Tk because I need it a graphic way to input data and display data too,
so right now I am working with Entry I am displaying data from a file to the Entry, the thing is that I added color to it, if it file has ACTIVE then it will be blue, when in the file has NON ACTIVE is red, but now I have a problem well look at the code :
sub Status_bancos { #Banamex########################################################## +######################### my $etiqueta_info1 = $upperframe->Label( -text => 'Santander :', )->pack(-side => 'left', -expand => 1); my $archivo1 = "santa1.txt"; open(DAT0, $archivo1) || die("Could not open file!"); my @stat0=<DAT0>; close(DAT0); foreach my $stat0(@stat0) { chomp ($stat0); my $banco0; my $stado0; ($banco0,$stado0)=split(/\|/,$stat0); if ($stado0 eq "ACTIVO"){ my $entry_info0 = $upperframe->Entry( -foreground => 'blue', -textvariable => \$stado0, -width => 20, )->pack(-side => 'left', -expand => 1); }else{ my $entry_info0 = $upperframe->Entry( -foreground => 'red', -textvariable => \$stado0, -width => 20, )->pack(-side => 'left', -expand => 1); } } my $label_info1 = $upperframe->Label( -text => 'Banamex :', )->pack(-side => 'left', -expand => 1); my $filename1 = "banamex.txt"; open(DAT1, $filename1) || die("Could not open file!"); my @stat1=<DAT1>; close(DAT1); foreach my $stat1(@stat1) { chomp ($stat1); my $banco1; my $stado1; ($banco1,$stado1)=split(/\|/,$stat1); if ($stado1 eq "ACTIVO"){ my $entry_info1 = $upperframe->Entry( -foreground => 'blue', -textvariable => \$stado1, -width => 20, )->pack(-side => 'left', -expand => 1); } else { my $entry_info1 = $upperframe->Entry( -foreground => 'red', -textvariable => \$stado1, -width => 20, )->pack(-side => 'left', -expand => 1); } } #HSBC################################################################# +################### my $label_info2 = $upperframe->Label( -text => 'HSBC :', )->pack(-side => 'left', -expand => 1); #---Extraccion de los datos de el archivo my $filename2 = "hsbc.txt"; open(DAT2, $filename2) || die ("Could not open file"); my @stathsbc=<DAT2>; close(DAT2); foreach my $statushsbc (@stathsbc) { chomp($statushsbc); my $banco2; my $stado2; ($banco2,$stado2)=split(/\|/,$statushsbc); if ($stado2 eq "ACTIVO"){ my $entry_info2 = $upperframe->Entry( -foreground => 'blue', -textvariable => \$stado2, -width => 20, )->pack(-side => 'left', -expand => 1); } else { my $entry_info2 = $upperframe->Entry( -foreground => 'red', -textvariable => \$stado2, -width => 20, )->pack(-side => 'left', -expand => 1); } } #Banorte############################################################## +############# my $label_info3 = $upperframe->Label( -text => 'Banorte :', )->pack(-side => 'left', -expand => 1); my $filename3 = "banorte.txt"; open(DAT3, $filename3) || die("Could not open file!"); my @stat3=<DAT3>; close(DAT3); foreach my $stat3(@stat3) { chomp ($stat3); my $banco3; my $stado3; ($banco3,$stado3)=split(/\|/,$stat3); if ($stado3 eq "ACTIVO"){ my $entry_info3 = $upperframe->Entry( -foreground => 'blue', -textvariable => \$stado3, -width => 20, )->pack(-side => 'left', -expand => 1); } else { my $entry_info3 = $upperframe->Entry( -foreground => 'red', -textvariable => \$stado3, -width => 20, )->pack(-side => 'left', -expand => 1); } } }
as you can see I have 8 Entries but visible there suppose to be only 4 whether is RED o BLUE, but every time I run it is displaying 5!!!!, the first one is the one that display 2 entries and I have type it, copy it but still same problem
Am I doing something wrong please help is very frustrating

In reply to A ghost Tk Entry in my program by padawan_linuxero

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.