Nilesh schrieb:
> if($text =~ m/&*Serv=(.*)[&$]/)
>
> it gives follwing error.
> Unmatched [ in regex; marked by <-- HERE in m/&*Serv=(.*)[ <-- HERE
> &5.008008/ at ./x.pl line 6
$] is a variable containing the Perl version. See perldoc perlvar.
But then, as you are using a character class, you are looking for the
letter "$", not for the end of a line. So don't use a character class.
You need to look for "&" OR end of line: (&|$). Then, .* is greedy,
that's not what you want, so add a ?. Additionally, &* in the beginning
of your regexp is useless.
You propably want something like
-> if ($text =~ /Serv=(.*?)(?:&|$)/) { ...
- Wolf
|