(I'm assuming you intended this for perl6-language)
"Myers, Dirk" wrote:
>
> > I certainly don't want m,
> > tr, or s to go away (or /regex/ either.) But the =~ bothers me. How
> > about disallowing m{...} and using m{expr}/.../?
>
> How about this, for the really compact way to do it:
>
> $line/pattern/ ;
What's the difference between matching $number/17/ogs;, and dividing
$number by 17, and the result by ogs()?
> or make the patterns themselves work like subs in this way:
>
> /pattern/ ($line) ;
>
> s/pattern/replacement/ ($line) ;
>
> (In this case, the presence of the $line disambiguates the /foo/ ; case, so
> these could also work as:
> /pattern/ $line ;
> s/pattern/replacement/ $line ;
> )
Now that's cool! I guess /pattern/ + 3 is a little ambiguous -- is it
adding a 3, or applying to +3? Anything worse than that?
It's a little strange in that the default argument is $_ instead of the
empty list, but that doesn't seem so bad.
Would it make sense to then make \&m/pattern/ mean something akin to
qr/pattern/? If so, then we'd probably want \&s, which means that in
\&s/pattern/repl$1$acement/ the $1 and the $acement are bound at
different times. Hmm, too much trouble?