Mix the string the integer calculation in a print statement : Print « Language Basics « Perl






Mix the string the integer calculation in a print statement

  

#!/usr/bin/perl -w

print "21 from 25 is: ", 25 - 21, "\n";

   
    
  








Related examples in the same category

1.Prints a welcome statement with escape character
2.Prints a welcome statement with several escape characters
3.You can pass a list of items to print, where you separate the list items with commas:
4.The print command prints out the text you provide it
5.Output two values in one print statement
6.print "Hello!\n";
7.Using comma in a print statement
8.Output the result of multiply with string
9.Output the result of division with string
10.Print only care about the first parenthesis
11.Put all into a parenthesis for print statement
12.Get the Power
13.Printing Output
14.Using Perl Built-in Functions
15.print function prints a string or a list of comma-separated words to the Perl filehandle STDOUT.
16.If the strings are not quoted, the filehandle STDOUT must be specified, or
17.The filehandle STDOUT must be specified if strings are not quoted.
18.Printing Numeric Literals
19.Printing String Literals
20.surrounding FINIS with single quotes
21.x 4 says that the text within the here document will be printed four times.
22.If terminator is in backquotes, will execute OS commands
23.The HTML tags are embedded in the here document to avoid using multiple print statements
24.Format text output with HTML tags
25.print 16 % 3;
26.print 2048 >> 3;
27.print 24 & 15;
28.print sqrt 4;
29.print -e STDIN; #Does STDIN exist?
30.print -t STDIN; #Is it tied to a terminal?
31.print -z STDIN; #Does it have zero size?
32.print $_ >= 0 ? $_ : -$_
33.print $_ < 10 ? $_ : "${\((a .. f)[$_ - 10])}\n";
34.print 1, 2, 3, 4, sort 9, 8, 7, 6, 5;
35.Print out here document
36.Syntax for the print Function
37.printf function prints a formatted string.
38.printf Flag Modifiers
39.Using the print Function