in reply to Re: regex for string
in thread regex for string

why we want to write this much code using "substr"? we can use like
$f = substr($str,0,1) $l=substr($str,-1);
what want to get first and last char by regex ? like that m/(.?)..etc/

Replies are listed 'Best First'.
Re^3: regex for string
by moritz (Cardinal) on Aug 18, 2009 at 09:13 UTC
    Because substr is the way to go, but you wanted a regex.

    So I gave you a regex, but still used substr.

    The real question is, why do you insist on using a regex? it's not a good idea, and far from being an ideal solution.

    Perl 6 projects - links to (nearly) everything that is Perl 6.