To avoid the extra variable hanging around, can't you just do:
my $days_re = join('|', @days); $days_re = qr/$days_re/;
Of course, I'd like some way to aggregate regular expressions and nicely apply operations like "concatenate" or "alternative" to them without having to drop back into string representations - that is, I'd like to be able to do:
my @days = qw( Sun Mon Tue Wed Thu Fri Sat ); my $days_re = re_alternative(map {qr/\Q$_\E/} @days);
Right now you have to do this, which is ok I guess, but I wonder if there are efficiency issues with the regular expression constructed this way:
my @days = qw( Sun Mon Tue Wed Thu Fri Sat ); my $days_re = join("|", map {qr/\Q$_\E/} @days); $days_re = qr($days_re);
-- @/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/ map{y/X_/\n /;print}map{pop@$_}@/for@/
In reply to Re: Re: Re: qr// with /e?
by fizbin
in thread qr// with /e?
by tkil
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |