InMotion Web Site Hosting
InMotion Hosting Home




Node:Output of Scalar Data, Next:, Previous:Operators, Up:Working with Scalars



Output of Scalar Data

To output a scalar, you can use the print and printf built-in functions. We have already seen examples of the print command, and the printf command is very close to that in C or C++. Here are a few examples:

use strict;
my $str  = "Howdy, ";
my $name = "Joe.\n";
print $str, $name;    # Prints out: Howdy, Joe.<NEWLINE>
my $f = 3e-1;
printf "%2.3f\n", $f; # Prints out: 0.300<NEWLINE>


InMotion Web Hosting Customer Support
M-F 8am - 7pm PST
213-239-0050

More information can be found at the InMotion Hosting Main Site