Numeric separator syntax: Difference between revisions
Content added Content deleted
(→{{header|zkl}}: added text) |
(→{{header|Perl 6}}: added perl) |
||
Line 124: | Line 124: | ||
ERROR: UndefVarError: __000__000 not defined |
ERROR: UndefVarError: __000__000 not defined |
||
</lang> |
</lang> |
||
=={{header|Perl}}== |
|||
Perl allows underscore as a grouping / separator character in numeric inputs, as long as you use it between digits, and you do not use two underscores in a row: |
|||
<lang perl># Int |
|||
print 1_2_3, "\n"; # 123 |
|||
# Binary Int |
|||
print 0b1_0_1_0_1, "\n"; # 21 |
|||
# Hexadecimal Int |
|||
print 0xa_bc_d, "\n"; # 43981 |
|||
# Rat |
|||
print 1_2_3_4.2_5, "\n"; # 1234.25 |
|||
# Num |
|||
print 6.0_22e4, "\n"; # 60220</lang> |
|||
=={{header|Perl 6}}== |
=={{header|Perl 6}}== |