Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

open(INFILE,"test2.txt") || die "$!";
print "Enter the pattern you wish to match: ";
  print "$_ contains the pattern $pat and teh number of $pat is $num_letters\n";
print "Number of $pat is $num_letters\n";
share|improve this question
This isn't really Ubuntu specific, you might wanna post it at – htorque Nov 10 '10 at 14:10

There is no better answer for this particular question than that provided by the perl documentation.

So to answer your question, I'll show how to show this documentation, and find the relevant bit.

To install the perl documentation. (perldoc is a bit like man, in fact you can often call man on many of the perl documentation)

sudo apt-get install perldoc

To read a document, enter perldoc and then the document name.

perldoc perldoc #this is the perldoc about how to use perldoc
perldoc perl #this is a good starting point, tells you about some available documentation

But to fast forward and answer your question, you'll need to read

perldoc perlretut

and search for the section titled "Global matching"

hope that helps.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.