in reply to processing a lot of files

If something isn't what you expect, print the values and use them to trace along. Try printing the values where you expect them to be set, and print the source you expect them to be set from.
For example, you set:
$sample = $fields[1];
but you have no check to see how many fields you actually found. Sample is undef? Then $fields[1] was undef, which implies in turn that there was no \t in your $_.

Replies are listed 'Best First'.
Re^2: processing a lot of files
by lomSpace (Scribe) on Jul 28, 2009 at 19:56 UTC
    This is not clear, particularly '$_'. I can process using open, but I run into
    problems with opendir and readdir. I want to change the format of the files. Still stuck }
      try the following on the command line
      perl -e 'opendir DIR, "./";@directory =readdir(DIR);for $entry (@direc +tory){print "$entry\n";}'
      in your while loop in the failing example $f is a string with the name of a file in it, you have to open, process and close the file inside the loop