[Edinburgh-pm] quotemeta
asmith9983 at gmail.com
asmith9983 at gmail.com
Sun May 25 16:56:30 PDT 2008
I thought I'd be smart and use quotemeta in a Small piece of code, but the
results weren't the same:-
my $domain1=quotemeta "192.1.1.";
my $domain2= "192\.1\.1\.";
$domain1 has backslashes embedded in the string assigned to it.
I was then intending to use the variable in the following match
m/$domainX(\d{1,3})/;
but only $domain2 worked which was obvious
Why does quotemeta not produce the same result as an assignment with
backslashes in the string ?
I realise I could remove the backslashes from $domain2 with :-
s/\\//g;
but I'd rather understand the root cause.
--
Andrew
More information about the Edinburgh-pm
mailing list