Hilo,

I'm not sure what's going on here, for some reason my array keeps growing as I look at each entry in the array.

This script looks at one .TAB file, compares each line's second tab stop text (probably very inefficiently) to all the other line's second tab stop text. I'm looking for duplicates.

This is on Mac panther, BTW. ... perl5 (revision 5.0 version 8 subversion 1 RC3)

#!/usr/bin/perl $| = 1; open ( ADDS, "./additions.tab" ); while ( $line = <ADDS> ) { chomp ( $line ); @div = split ( /\t/, $line ); $blip = 0; # increment integer, keeps track of tab stops foreach my $atom (@div) { @{$lines[$lino]}->[$blip++] = $atom; } $lino++; # increment integer, keeps track of lines } close ADDS; foreach my $Line (@lines) { $dinky = 0; # toggle integer, for existance of duplicates $startat++; # duel use. # 1 Keeps track of already inspected lines, to avoid redoing that work # 2 Let's me see output by printing every few lines foreach my $tick ($startat..( scalar ( @lines ) )) { if ( $lines[$tick]->[1] eq $Line->[1] ) { print (join ( "\t", ( @{ $lines[$tick] } ) ) +) . "\n"; $dinky++; } } print (join ( "\t", ( @{$Line} ) )) . "\n" if ( $dinky > 0 +); print STDERR $startat . "\n" if ( !( $startat % 100 ) ); print STDERR "(" . scalar ( @lines ) . ")\n" if ( !( $startat +% 100) ); }

Sample Output:

100 (2506) 200 (2606) 300 (2706) 400 (2806) 500 (2906)

In reply to Oddly growing array by arsoncupid

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.