Naser Ali wrote:
I have an array which was created by slurrping a whole text file.
There are certain element in the array after reading the files
which contain only one word. I want to only match those array
elements which contain a single word and print it.

You need to anchor the word to both the beginning and the end of the string. Something like this:

    print grep /^\w+$/, @array;

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to