i tried doing this but i get an error

#!/usr/bin/perl -w use strict; use warnings; # program identifies if the number series contains > 2500 continuo +us numbers # read this number series into a arr1 # if (length < 2500) # then ,discrad # else { # for (i=1 to $len) # idenitfy the indices where there are breaks and # store these indices into arr2 # foreach element in this @arr2 # if the difference in the indices > 2500 # then take the diff and print the range use Data::Dumper; my @files = </Users/distance/8A/*>; foreach my $file (@files){ my $file = $ARGV[0]; open INFILE," $file" or die "$!\n"; <INFILE>; <INFILE>; my @arr1 = <INFILE>; close INFILE; my $len = scalar(@arr1) ; print "$len\n" ; my (@range, %h, @numbers); if ($len < 2500) { print "no use of searching\n" ; } else { my $last_line = $#arr1; my ($range_start, $range_end) = ('', ''); for (my $i = $last_line; $i > 0; $i--) { my $line = $arr1[$i]; if ($line =~ /t:\s*(\d+)/) { push(@numbers, $1); } } } if (scalar @numbers){ for (my $i = 0; $i< scalar(@numbers); $i++){ last if ($i+1 > $#numbers); my $f = $numbers[$i]; my $s = $numbers[$i+1]; if ($f - $s == 1) { $h{s} = $f if (!$h{s}); $h{e} = $s; }else{ push(@range, [[$h{e}, $h{s}]]); $h{s} = 0; $h{e} = 0; # can be updated to any number to get all the ranges # for now gives only two ranges last if (scalar @range == 2); } } } # in case its only one range if ($h{s} && $h{e} && !scalar(@range)) { push (@range, [$h{e}, $h{s}]); } print Dumper \@range; }
i get an error as= Use of uninitialized value $file in concatenation (.) or string at test.pl line 31

In reply to Re^2: find the continuity in the data file by extrem
in thread find the continuity in the data file by extrem

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.