in reply to LWP::UserAgent & match
$todaysQuoteStr =~ quotemeta($todaysQuoteStr); ## I believe this escapes all characters that need to be escaped
Not quite, no. The right hand side uses quotemeta to do that but then you don't assign the result to anything. This will show the difference that an assignment makes:
#!/usr/bin/env perl use strict; use warnings; my $todaysQuoteStr = ' data-reactid="49"><span class="Trsdu(0.3s) Fw(b +) Fz(36px) Mb(-4px) D(ib)" data-reactid="50">'; $todaysQuoteStr =~ quotemeta($todaysQuoteStr); print "Bad: $todaysQuoteStr\n"; $todaysQuoteStr = quotemeta($todaysQuoteStr); print "Good: $todaysQuoteStr\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: LWP::UserAgent & match
by vskatusa (Acolyte) on May 21, 2020 at 16:26 UTC | |
by vskatusa (Acolyte) on May 21, 2020 at 16:51 UTC | |
by perlfan (Vicar) on May 22, 2020 at 03:58 UTC |
In Section
Seekers of Perl Wisdom