note
cjf
<p>So you want to open a file and print out all lines that only contain one word? If so, this should work:</p>
<code>
open FILE, "file.txt" or die $!;
while (<FILE>) {
chomp;
print "$_\n" if $_ =~ /^(\w+)$/;
}
close FILE;
</code>
<p>Let me know if you have any questions.</p>
<p><b>Update:</b> ++'s to [tadman] for the improvements below.</p>
181685
181685