in reply to Re: Re: qr// with /e?
in thread qr// with /e?
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@/
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: qr// with /e?
by tkil (Monk) on Apr 24, 2004 at 05:30 UTC | |
by hv (Prior) on Apr 24, 2004 at 09:32 UTC | |
by tkil (Monk) on Apr 26, 2004 at 04:40 UTC | |
by hv (Prior) on Apr 26, 2004 at 09:14 UTC |