Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

print matches

Status
Not open for further replies.

piadex2

Technical User
Oct 7, 2008
1
HU
Dear Readers,

I am new to Perl so I am sorry for writing this simple problem but I have to write it because I can not solve it.
I know how to match strings but if there is a match then how can I print it out to the screen or write it into a file?
Thank you for your help in advance:

piadex2
 
Hope this answers your question!!

Code:
use strict;
my $input;
#Search for "zoo" in the text that was input by the user
print "Enter your input, program checks for the word 'zoo' :";
$input= <STDIN>;
chomp($input);
if($input=~/zoo/)
{
	print "success";
}
else
{
	print "faiilure";
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top