At 11:39 PM 12/20/00 +0000, Nicholas Clark wrote:
>On Wed, Dec 20, 2000 at 03:36:48PM -0800, Peter Scott wrote:
> > Should this second paragraph still be true for Perl 6? I have at times
> > wanted to do something of the form
> >
> > perl -lwe '$x = "x"; $y = "y"; $y =~ ($x eq "x" ? s/y/z/ : s/y/a/);
> print $y'
> >
> > but I have not wanted to make the right argument an expression to be
> > interpreted as a search pattern (since I have qr//).
>
>I presume that you don't find
>
>perl -lwe '$x = "x"; $y = "y"; $x eq "x" ? $y =~ s/y/z/ : $y =~ s/y/a/;
>print $y'
>
>does what you need because you actually want to do something a lot more
>complex than simple "$y =~" in your expression.
>Or do I guess wrong?
Oh, that certainly works, and I wouldn't have any complaint on grounds of
brevity alone unless I wanted an lvalue expression like ($x ? $y : $z)
instead of $y. But since this is a Perl 6 list, I'm making an inquiry on
syntactical convenience grounds. What I wanted to write *feels* Perlish.
--
Peter Scott
Pacific Systems Design Technologies