user1613245
user1613245

Reputation: 351

How to display INR wth perl?

How to create a Indian rupee symbol with perl code and print it on screen or file?

Upvotes: 1

Views: 121

Answers (1)

Vishal Verma
Vishal Verma

Reputation: 982

Here is a one-liner perl:
perl -e 'binmode(STDOUT, ":utf8");print "\x{20B9}\n"'

Output:

Explanation:
1) binmode(STDOUT, ":utf8");
Sets the out standard output from perl to support UTF8. This UTF8 allows you to display extended symbols

2) Unicode value for Rupee is U+20B9 (Refer Wikipedia)

3) To display this
print "\x{20B9}\n"
Pushes this symbol to standard Output. And above setting (1) configured Standard Output to support it's output, which is

You may embed this snippet in your code.
I hope it helps others too! :)

Upvotes: 4

Related Questions