> A question I assume can be answered using regexp, unfortunately I am > just starting my way into it. I have a bunch of words that I want to > split, so that the first letters (minus n) and the last n-letters are > seperated. > n is user defined and therefore not static. > > How can I have Perl split at the last n-letters from the end of a word? > > Any help is appreciated (hints as where to find the answer myself > without buying a book are also very welcome!) >
A regexp could probably be used, but I am wondering if 'substr' is a better match (pun intended). perldoc -f substr perldoc -f length You can provide a negative index to start from the end of the string. So then you are looking for the first part, aka 0 to -index, and -index to length(string). helps? http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>