Hello All;
I was hoping to write this script in a more concise manner, also
eliminate the error I get with it, along with correcting it indexing at only
one occurence. Thanks for your help!

#!/usr/bin/perl
use warnings;

print ($TargetString = <<TARGET);
The intellect of man is in...
........etc..
TARGET

$SearchString = "";
print "\nType the string \"in\" to begin a search: " . $SearchString;

$SearchString = <STDIN>;
chomp($SearchString);
print "\nSearch begun for \"" . $SearchString . "\"...";

my $IndexLocation = index($TargetString , $SearchString, 0);
print "\nString found at index " . $IndexLocation . "...";

$IndexLocation = ($IndexLocation + 1);
$IndexLocation = index($TargetString, $SearchString, $IndexLcation);
print "\nString found at index " . $IndexLocation . "...\n";



--
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