print और say
print text को exactly दिए गए रूप में लिखता है, और say वही करता है लेकिन एक newline add करता है।
In this page:
print और say
print values की एक list बिना separator और बिना automatic newline के output करता है। say function, जो use feature say या use v5.10 से enable होता है, आपके लिए एक newline append करता है। दोनों STDERR जैसे एक filehandle में print कर सकते हैं जब आप handle को पहले रखें, इसके बाद कोई comma नहीं।
Note:
print items के बीच separator बदलने के लिए $, set करें और हर print के अंत में कुछ add करने के लिए $\।
उदाहरण: print and say
use strict;
use warnings;
use feature 'say';
print "one", "two", "three";
print "\n";
say "hello";
say "a", "b", "c";
{
local $, = "-";
say "x", "y", "z";
}
print STDOUT "to STDOUT\n";
# Output:
# onetwothree
# hello
# abc
# x-y-z
# to STDOUT
Login to try C/C++/Java/PHP code in the editor
आम गलतियां
- यह भूल जाना कि print कोई newline add नहीं करता
- feature enable किए बिना say call करना
- print STDERR, "text" में filehandle के बाद एक comma लगाना
चैप्टर सारांश
- print कोई newline add नहीं करता
- say एक newline add करता है
- say को use feature say चाहिए
- एक filehandle के बाद कोई comma नहीं
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: