PERL Tutorial Example: use of literal constant END in perl

PERL Tutorial Example: use of literal constant END in perl

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

print "\n\n";
print "Anything after __END__ literal constant is text to PERL & will be Ignored.\n";

__END__

print "\n\n";

$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 __END__ literal constant is text to PERL & will be Ignored.\n";

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

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

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

The result in the windows command prompt

No comments:

Post a Comment

leave your comments here..