I'm very new to Perl and I'm trying to figure out just how to get this thing to work.
I found an example in this thread: Perl Regex - Print the matched value
Here is the example I'm trying to work with:
perl -e '$str="the variable Xy = 3 in this case"; print $str =~ /(Xy = 3)/;'
I've tried running it using cmd, but that produces this error:
"Can't find string terminator "'" anywhere before EOF at -e line 1."
When I run it in powershell nothing happens.
My ultimate goal is to set a variable at the command line, run a regexp find (and sometimes replace), and to print the result. This way I don't have to write a script every time I write a regexp pattern.
I've tried using the debugger, but nothing happens when I do this after setting the variable:
print $str =~ /(Xy = 3)/;