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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |