When submiting these kinds of problems you should always include the platform that you are running on.
 
Chances are this has nothing to do with perl, but everything to do with your shell
 
To illustrate, from an aix prompt simply typing:
printf $321
will get you the same result that you got from your perl script as will
printf "$321"
However if you try:
printf '$321'
you may well get the result you want because in ksh the single quote shields the shells special characters from the shell.
 
It all relates to the shells interpretation of special characters and variable interpolation.
With no quotes and inside double quotes the shell expands Variables starting with
the $ sign.   And in this case there is a special set of variables $0 to $9 etc...
in your case the $3 variable happens to be blank.
 
Try running your program with $0321 instead of $321 chances are the $0 variabloe is set and you might get something like
You got: -ksh321


Eddy Tan <[EMAIL PROTECTED]> wrote:
I wonder if someone could help me with this simple script.

# doh.pl
$ARGV[0] =~ s/\$/\\\$/;
print "You got: $ARGV[0]";

Then run the script:
doh.pl $321
You got: 21 --> Im expecting to get $321

How do I fix it?
Ta.



__________________________________
Do you Yahoo!?
Send holiday email and support a worthy cause. Do good.
http://celebrity.mail.yahoo.com
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


_______________________
Dave Blakemore
[EMAIL PROTECTED]
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to