Mega Code Archive

 
Categories / Perl / Language Basics
 

Printing Numeric Literals

#!/usr/bin/perl # Program to illustrate printing literals print "The price is $100.\n"; print "The price is \$100.\n"; print "The price is \$",100, ".\n"; print "The binary number is converted to: ",0b10001,".\n"; print "The octal number is converted to: ",0777,".\n"; print "The hexadecimal number is converted to: ",0xAbcF,".\n"; print "The unformatted number is ", 14.56, ".\n"; $now = localtime(); # A Perl function $name = "A"; # A string is assigned to a Perl variable print "Today is $now, $name."; print 'Today is $now, $name.';