<?xml version="1.0" encoding="windows-1252"?>
<node id="1007352" title="while loop returning numbers not strings" created="2012-12-05 13:06:12" updated="2012-12-05 13:06:12">
<type id="115">
perlquestion</type>
<author id="1002699">
jaffinito34</author>
<data>
<field name="doctext">
&lt;p&gt;
I just started a script where I take in a text file (words.txt) where there is a new word each line.  I used a while loop to read each line and a split to assign the words to a variable.  My problem is that the output is not the word, it is the number of characters plus one.  For example, the first word is 'tutor' and the print statements prints '6'.  I'm thinking its because of the newline that it is adding one but even so, I don't know why its not printing the string. Ive used this type of statement before and never had issues.
&lt;/p&gt;

&lt;code&gt;
#! /usr/bin/perl


open (WORD, '&lt;', 'words.txt');

while ($lines = &lt;WORD&gt;){
	@word = split "", $lines;
	
	print @word."\n";
}

print "\n\n";

&lt;/code&gt;</field>
</data>
</node>
