thank you for reading.
For a shell command to wget, something like this works:
wget -q -O - http://www.myweb.com | grep -oe '\w*.\w*@\w*.\w*.\w\+' | sort -u
However, when I try to insert that command inside the Perl program, then I get a syntax error referring to “backslashes found where operator expected, bareword found where operator expected”. So I replaced the quotes that surround the regex by this {} but, what that does is just like commenting it out, it does not bring the error, but it is as if the regex weren’t, so obviously the curly braces are a wrong attempt.
This is the code, it is inside a foreach:
foreach(@my_array) {
$browser->get($_);
# and here below is where the error comes
system ('wget -q -O -"$_" | grep -oe '\w*.\w*@.\w*.\w\+' | sort -u');
If I replace the single quotes wrapping the regex by {}, then wget does get the URLs but the grep command does not act.
So that is the issue, how to resolve the quotes annoying the syntax
You want this:
You can include what you like within double quotes, only you have to escape certain characters.
Incidentally, Perl’s
qq()operator might interest you. You can look it up.