Tutorials Point


  Perl Home

  PERL Functions

© 2011 TutorialsPoint.COM


  Home     References     About TP     Advertising  

PERL sprintf Function



Syntax

sprintf FORMAT, LIST


Definition and Usage

The sprintf function uses FORMAT to return a formatted string based on the values in LIST. Essentially identical to printf, but the formatted string is returned instead of being printed.

Return Value

  • SCALAR, a formatted text string.

Example

Try out following example:

#!/usr/bin/perl -w

$text = sprintf("%0d \n", 9);

print "Formated string $text\n";

It will produce following result:

Formated string 9


Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names