Thanks to visit codestin.com
Credit goes to www.tutorialspoint.com

Multiline Strings in Perl



If you want to introduce multiline strings into your programs, you can use the standard single quotes as below −

Example

 Live Demo

#!/usr/bin/perl
$string = 'This is
a multiline
string';
print "$string\n";

Output

This will produce the following result −

This is
a multiline
string

You can use "here" document syntax as well to store or print multiline as below −

Example

 Live Demo

#!/usr/bin/perl
print <<EOF;
This is
a multiline
string
EOF

Output

This will also produce the same result −

This is
a multiline
string
Updated on: 2019-11-28T09:12:15+05:30

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements