in reply to find the substring

Welcome to perlmonks! If you show us the code you have written so far we might be able to help with a specific problem. You can remove hyphens and periods from a string using:
s/-\.//g;
and then compare strings using 'eq'.

Replies are listed 'Best First'.
Re^2: find the substring
by roc (Sexton) on Feb 20, 2008 at 17:53 UTC
    I guess the answer is to turn the substrings you are looking for into regular expressions that accommodate the presence of '-' and '.' between the letters. For example,
    #!/usr/local/bin/perl $str = "a[-\.]*?b[-\.]*?c"; $str2 = "zzzza---..bcddddd"; $str2 =~ /($str)/; print $1,"\n";
    The use of the grouped regexp between /.../ allows you to remember the substring that matched the regexp.

    But i'm not sure with that,can you please give some idea or give me your script if it's possible.