[Templates] How to get the first character of a string?

Andy Wardley abw@kfs.org
Tue, 12 Mar 2002 12:55:09 +0000


[%# on the subject of something.match %]

On Sat, Jan 26, 2002 at 06:22:43PM -0800, Craig Barratt wrote:
> Nice!  But match is almost identical to search.  There is a slight
> difference in the way the results are returned:
> 
>     match>   my @matches = ($str =~ /$search/);
>     match>   return @matches ? \@matches : '';
> 
>     search>  return $str =~ /$pattern/;
> 
[...]
> So how about we replace "search" with the new "match" and not have
> two different functions?

Yep.  Or rather, I'll document search as being defunct, replaced by match,
but leave it in there for now.

There's a pun in there somewhere, I'm sure... :-)

A