qr//e?

Tkil tkil-sdpm at scrye.com
Fri Apr 23 16:15:46 CDT 2004


~sdpm~

Fellow mongers:

Can anyone think why /e might be a bad idea to suggest for addition to
the qr// operator?

I found myself doing something like this, the other day:

   my @days    = qw( Sun Mon Tue Wed Thu Fri Sat );
   my $days_re = qr/join '|', @days/e;

And I was startled to discover that qr doesn't have a /e flag.
Granted, it has only ever been in the substitution part of s///, but
this seems pretty straightforward.  There are obvious workarounds:

   my $days_re = do { my $tmp = join '|', @days; qr/$tmp/ };

Or, in this particular case, something almost as ugly:

   my $days_re = do { local $" = '|'; qr/@days/ };

Still, it seems that /e might be entirely useful on qr//.  Anyone have
examples or counter-examples that come to mind?

t.
~sdpm~

The posting address is: san-diego-pm-list at hfb.pm.org

List requests should be sent to: majordomo at hfb.pm.org

If you ever want to remove yourself from this mailing list,
you can send mail to <majordomo at happyfunball.pm.org> with the following
command in the body of your email message:

    unsubscribe san-diego-pm-list

If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to <owner-san-diego-pm-list at happyfunball.pm.org> .
This is the general rule for most mailing lists when you need
to contact a human.




More information about the San-Diego-pm mailing list