PERL Tutorial Example: use of literal constant data in perl

PERL Tutorial Example: use of literal constant data in perl

create a file named "perl-tutorial-example-literal-constants-data-in-perl.pl" then copy and paste the below code:

print "\n\n";

print <DATA> ;

print "\n\n";

__DATA__
$DecimalNumber   = 999;
$BinaryNumber   = 0b1111100111; # adding 0b before a Binary number will convert it to Decimal
$HexadecimalNumber = 0x3E7; # adding 0x before an Hexadecimal number will convert it to Decimal
$OctalNumber   = 01747; # adding 0 before an Octal number will convert it to Decimal
print "$DecimalNumber \n\n";
print "$BinaryNumber \n";
print "$HexadecimalNumber \n";
print "$OctalNumber \n";
print "Anything after __DATA__ literal constant is text to PERL & will not processed.\n";

PERL Example Base Tutorial: use of literal constant data in perl

Now run the program (perl-tutorial-example-literal-constants-data-in-perl.pl) from command prompt & get results as follows:

PERL Tutorial Example: use of literal constant data in perl - output in the windows command prompt

The result in the windows command prompt

No comments:

Post a Comment

leave your comments here..