Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
$text=$ARGV[0]; print "$text\n";
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
"This is 00"
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??
Any help is appreciated.
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do I escape a "$" in the input stream
by projekt21 (Friar) on Sep 10, 2002 at 09:19 UTC | |
|
Re: How do I escape a "$" in the input stream
by blm (Hermit) on Sep 10, 2002 at 09:15 UTC |