[wellylug] Perl problem -- warning, I know nothing about Perl syntax ;-)
Grant McLean
grant at mclean.net.nz
Tue Mar 23 07:09:27 NZST 2004
Damon Lynch wrote:
> This innocuous looking line of code:
>
> if ($fentry->{regexp}) { @toadd = grep { /$name/ } @$rpms }
>
> is giving me this error:
>
> Quantifier follows nothing in regex; marked by <-- HERE in m/* <-- HERE / at ....
If $name can contain special regex characters (eg: '.') and you
want them to be interpreted as literal characters without the
special regex meaning then you could change the code to this:
if ($fentry->{regexp}) { @toadd = grep { /\Q$name\E/ } @$rpms }
If you want to shell style pattern matching to select files then the
builtin function glob might be what you're after.
Cheers
Grant
More information about the wellylug
mailing list