in reply to Re^2: Print function
in thread Print function

Are those lines empty or full of tab characters? Maybe the CytokineArrays.txt file ends by some 900 empty lines. Try to add

next unless /\S/;
after the chomp; in the second loop.

Also, there is no difference between $var =~ /\S+/ and $var =~ /\S/. Except that the later will probably be quicker. Both return true whenever there is at least one non-whitespace-character anywhere in the $var. Same with the \d. Maybe you wanted $var =~ /^\S+$/. Which means ... make sure the $var contains only non-whitespace-characters and is not empty.

Update: fixed the typo noticed by jwkrahn. I meant \S+ and wrote \s+.

Replies are listed 'Best First'.
Re^4: Print function
by jwkrahn (Abbot) on Sep 02, 2008 at 16:47 UTC
    Maybe you wanted $var =~ /^\s+$/. Which means ... make sure the $var contains only non-whitespace-characters and is not empty.

    I think that you meant $var =~ /^\S+$/ for non-whitespace-characters?

Re^4: Print function
by de2425 (Sexton) on Sep 02, 2008 at 19:51 UTC
    Thank you very much. That did the trick.