Hi, How can i get the index of the row and column where the data is missing or corrupt in the table?? Here is what I was trying:
#!/usr/bin/perl #use strict; #use warnings; use Data::Dumper; my @array; my $line=""; my @data; my @list; my $maps_dir=""; my $dir=""; my $part_no=""; my $chg_lvl=""; my $int_lock=""; my $t_spec=""; my $file=""; my $FILE; my $i=0; my $num_of_columns; my $x; my $y; my $temp="No"; my $temp1; my $temp2; if ($#ARGV == -1) { print("Enter a part number file name:\n"); chomp($file=<>); } else { $file=$ARGV[0]; } if(!-e $file) { print "File:$file does not exist"; } open ($FILE,"<$file"); while(<$FILE>) { $i++; chomp; @data=split/\s+/; push @list, [split/\s+/]; $num_of_columns=@data; } #print Dumper( @list ), "\n\n"; #print "Number of rows is $i\n"; #print "Number of columns is $num_of_columns\n"; for($x=0;$x<=$i;$x++) { for($y=0;$y<=$num_of_columns;$y++) { if(!$list[$x][$y]) { $temp1=$x; $temp2=$y; } } } print $temp1;----->Here it prints the last row instead of the index wh +ere there is no data #print $list[1][5], "\n"; # print close($FILE);

In reply to Re^2: Reading a file as an multi dimensional array Please help by sas429s
in thread Reading a file as an multi dimensional array Please help by sas429s

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.