printf "%o\n", 455; : printf « String « Perl
Home
Perl
1.
Array
2.
CGI
3.
Class
4.
Data Type
5.
Database
6.
File
7.
GUI
8.
Hash
9.
Language Basics
10.
Network
11.
Regular Expression
12.
Report
13.
Statement
14.
String
15.
Subroutine
16.
System Functions
17.
Win32
18.
XML
Perl
»
String
»
printf
printf "%o\n", 455;
#!usr/bin/perl
use warnings;
use strict;
printf
"%o\n"
,
455
;
Related examples in the same category
1.
Field specifiers for printf.
2.
Format Codes for the sprintf and printf Functions
3.
printf Data Formats
4.
%.2f specifies a floating-point number with two decimal digits
5.
%3d specifies that the integer number should be displayed with three digits
6.
%x: Hexadecimal
7.
Insert multiple values to printf
8.
Output month name and week name by using the return value from gmtime
9.
Printing a percent sign after a digit
10.
Printing a space before signed values not preceded by + or -
11.
Printing integers right-justified
12.
Printing numbers with the + flag
13.
Printing numbers without the + flag
14.
Printing out an array of string one by one
15.
Printing with the 0 (zero) flag fills in leading zeros
16.
The printf formats a string and prints it to the given file handle:
17.
To print a single text string using %s
18.
Using precision while printing floating-point numbers
19.
Using precision while printing integers
20.
Using precision while printing strings
21.
Using the # flag with conversion specifier X
22.
Using the # flag with conversion specifier g
23.
Using the # flag with conversion specifier o
24.
printf "%+.4e\n", $value;
25.
printf "%.5f\n", $value;
26.
printf "%c is ASCII value 65 and %c is value 66\n", 65, 66;
27.
printf "%d\n", +455.34;
28.
printf "%d\n", -455;
29.
printf "%d\n", 455.954;
30.
printf "%u\n", -455;
31.
printf "%u\n", 455;
32.
printf "%x\n", -455;
33.
printf "Left-justified the number is |%-10d|\n", 100;
34.
printf "The character is %c\n", 65;
35.
printf "The floating point number is |%8f|\n", 15;
36.
printf "The formatted floating point number is |%8.2f|\n",14.3456;
37.
printf "The formatted number is |%10d|\n", 100;
38.
printf "The number in decimal is %d\n", 45;
39.
printf "The number in hexadecimal is %x\n", 15;
40.
printf "The number in octal is %o\n",15;
41.
printf "The number printed with leading zeros is |%010d|\n", 5;
42.
printf "This string is %s\n", "literal";
43.
printf("%-15s%-20s\n", "Jack", "Sprat");
java2s.com
|
Contact Us
|
Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.