Just another Perl shrine | |
PerlMonks |
How do I escape a "$" in the input streamby Anonymous Monk |
on Sep 10, 2002 at 09:04 UTC ( [id://196587]=perlquestion: print w/replies, xml ) | Need Help?? |
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi I am a new user here and this is my first posting. I am writing a snippet of code to read an input string from command line. Here is the snippet I use :
This reads the value of ARGV[0] into a variable and prints it. If I give it an input of "This is $200", the print out is
I understand that this happens because perl interprets $2 like a (reg-ex) variable rather than a dollar value (money). Printing $text with a single quote will not interpolate the $text variable.
How can I read a line from input stream with a dollar in it??
Back to
Seekers of Perl Wisdom
|
|