How to retrieve a number or string from file1 and redirect into file2 in perl script?

hello forum members,

I am siva ,As i am new to perl scripting i looking help from forum members.

i need a sample program are command for pattern matching.

I have file name infile1 which some data, I need to search the particular number are string in the file which repeats n number of times, so i need to extract the
particular string are number and write in another file name as a outfile1.

I am looking forward from you

Thanks
Siva.