Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

return value of s///

623 views
Skip to first unread message

Nicholas Clark

unread,
Nov 19, 2004, 5:20:23 PM11/19/04
to perl6-l...@perl.org
Synopsis 5 has a section on the return value from matches:

http://www.wall.org/~larry/syn/S05.html#return_values_from_matches

However, it has nothing on the return values of substitutions.

In perl 6 will these always return a match object? Or will it be as perl 5
and return the number of substitutions (or the empty string if none)

Nicholas Clark

Larry Wall

unread,
Nov 19, 2004, 8:11:37 PM11/19/04
to perl6-l...@perl.org
On Fri, Nov 19, 2004 at 10:20:23PM +0000, Nicholas Clark wrote:
: In perl 6 will these always return a match object? Or will it be as perl 5

: and return the number of substitutions (or the empty string if none)

Yes, and yes. The match object returns the number of substitutions
in a numeric context. If there is no match, it returns 0 in a numeric
context or undef in a string context.

Larry

0 new messages