#! /usr/bin/perl -w use strict; print "Enter a string: "; chomp(my $string = ); print "Enter a substring: "; chomp(my $substring = ); my $result = index($string, $substring); if ($result != -1) { print "the substring was found at index: $result\n"; } else { print "the substring was not found\n"; }