Can't use global $_ in "my" at script line 4, near "my $_ " Execution of script aborted due to compilation errors.
Your code has other problems too, like this will be interpreted as a regexp:
print /$x/;
Are you trying to learn how to expand variables in single-quoted constructs/program input? Normally perl does not interpolate variables inside of single-quoted constructs, you should use double-quotes. But you can use a regexp or eval to interpolate variables where perl would not normally do that.
OK, I see from another forum that you wanted to literally find the literal expression $x inside of $_. You discovered how to do that. So I just wasted my time helping you above with the same answers you got on another forum that were not even the point of your question.
Kevin, Thank you very much anyway !
I appreciate your wish to help !!
By the way, I'm not a student.
I have a degree in Math+Computer Science, but I never learned Perl.
Now, I'm learning Perl from internet.
I must admit that I like it very much !!!
Tell me please, do you know another Perl forums in which I can get answers fast ?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.