原文链接:https://www.geeksforgeeks.org/perl-multi-line-strings-here-document/
Multi–line string using Here Document
Here Document is an alternative way for multiple print statements. A Here-Document can also be used for multi–line string. It declares a delimiter at the start to know till where the string needs to take input. A Here-Document starts with ‘<<’ followed by the delimiter of the user’s choice. The string reads the code until the delimiter occurs again and all the text in between is taken as the string.
```c
```c
# Perl code to illustrate the multiline
# string using Here-Document
# consider a string scalar
$GeeksforGeeks = 'GFG';
# defining multiline string using
# ending delimiter without any quotes
$deli = <<string_ending_delimiter;
Multiline string using
Here-Document on
$GeeksforGeeks
string_ending_delimiter
# displaying result
print "$delinn";
# defining multiline string using
# ending delimiter with double quotes
$deli = <<"string_ending_delimiter";
Multiline string using
Here-Document on
$GeeksforGeeks
string_ending_delimiter
# displaying result
print "$delinn";
# defining multiline string using
# ending delimiter with single quotes
$deli = <<'string_ending_delimiter';
Multiline string using
Here-Document on
$GeeksforGeeks
string_ending_delimiter
# displaying result
print "$delinn";
原文地址:https://blog.csdn.net/hungtaowu/article/details/134810528
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_45860.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!