Comments और POD
Comments मनुष्यों के लिए notes हैं जिन्हें Perl ignore करता है।
In this page:
Comments और POD
एक hash sign # एक comment शुरू करता है जो line के अंत तक चलता है। Perl में कोई block comment syntax नहीं है, लेकिन POD (Plain Old Documentation) blocks लंबे text के लिए इस्तेमाल हो सकते हैं: =pod या =begin comment जैसी एक line से शुरू होकर और =cut से खत्म होने वाला एक block interpreter skip कर देता है। POD Perl modules document करने का standard तरीका भी है।
Note:
एक quoted string के अंदर एक # बस एक character है, comment नहीं।
उदाहरण: Comments and POD
use strict;
use warnings;
# This is a single-line comment
print "Step one\n"; # comment after code
=begin comment
This whole block is ignored by Perl,
so it works like a multi-line comment.
=end comment
=cut
print "Step two # not a comment\n";
# Output:
# Step one
# Step two # not a comment
Login to try C/C++/Java/PHP code in the editor
आम गलतियां
- यह उम्मीद करना कि C-style /* */ block comments काम करेंगे
- एक POD block को खत्म करने वाली =cut line भूल जाना
- =pod जैसी POD directives को एक line की शुरुआत के अलावा कहीं और शुरू करना
चैप्टर सारांश
- # एक comment शुरू करता है
- POD blocks कई lines hide कर सकते हैं
- एक POD block =cut से खत्म होता है
- एक string के अंदर एक # comment नहीं है
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: