On Fri, May 13, 2005 at 03:23:20AM +0800, Autrijus Tang wrote:
> Is it really intended that we get into habit of writing this?
>     if 'localhost:80' ~~ /^(.+)\:(\d+)$/ {
>       my $socket = connect(~$0, +$1);
>     }
> It looks... weird. :)

And it would have to be

     if 'localhost:80' ~~ /^(.+)\:(\d+)$/ {
        my $socket = connect(~$0, ~$1);

because +$1 still evaluates to 1.  (The ~ in front of $0 is 
probably optional.)

My suggestion is that a match object in numeric context is the
same as evaluating its string value in a numeric context.  If
we need a way to find out the number of match repetitions (what
the numeric context was intended to provide), it might be better
done with an explicit C<.matchcount> method or something like that.


Reply via email to