> > > s/Perl/(Bike Riding|Gardening|Cooking|Painting|Teaching|Filmmaking)/;
> 
> Oddly enough, the the syntactically correct code does not quite have the same
> meaning or elegance. ...

\begin{nitpick}
The s/// is already syntactically correct.  :-)
\end{nitpick}

> ... Note that I modified the list slightly to avoid manual
> quoting:
> 
> s/Perl/$z=sub { $_[rand(@_)] }; &$z(qw(Biking Gardening Cooking Painting 
> Teaching Filmmaking))/e;

Do we need a sub?  An anonymous sub?

Why not the following?

  || s{
  ||     Perl
  || }{
  ||     my @z = qw(Biking Gardening Cooking Painting Teaching Filmmaking);
  ||     $z[rand @z];
  || }xe;

Or less readably:

  || s/Perl/@z=qw(Bik Garden Cook Paint Teach Filmmak);[EMAIL PROTECTED]"ing"/e;

:-)

I agree that about the "elegance" comment, however.  :-)

peace,               || Udayachal: a newspaper edited by slum children:
--{kr.pA}            || http://tinyurl.com/57jaf
-- 
This .sig intentionally left blank.
 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to