find sub { my $numb = (fileparse($_,'.txt'))[0]; return unless $numb =~ /^\d+$/; push @ARGV, $File::Find::name if $numb >= $start and $numb <= $end; }, $dir;

Basically, this code goes to a directory and read all the files in it.
Sounds like a job for readdir.
opendir DIR, $dir or die "Failed to open directory $dir: $!"; foreach my $file (readdir DIR) { # much the same as using fileparse my ($number, $ext) = split /\./, basename($file); next unless $ext eq "txt"; next unless $number =~ /^\d+$/; next unless $number < $start || $number > $end; push @ARGV, "$dir/$file"; }
but that's just one suggestion. It seems to me that using File::Find is somewhat overkill for this problem as File::Find will happily recurse your entire directory tree and that might take quite some time.

Of course if you need it to recurse your directory tree then readdir will be useless and you've chosen the correct tool.

If you're certain that the problem does not lie in your call to find, perhaps you should print out @ARGV and have a look at its contents. Something like:

{ local $, = "\n"; print @ARGC; }
should do the trick nicely.

Note that when you print in your while loop at the bottom you're concatenating all the files together when they were originally separate. So if @ARGV ended up containing 10 files then your output will be all 10 files concatenated after the substitution.

Hope this helps.

jarich


In reply to Re: text file parsing by jarich
in thread text file parsing by Anonymous Monk

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.