in reply to Here documents in blocks
Something like this ?
#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11125451 use warnings; sub indent { my $text = shift; $text =~ s/^\s//gm until $text =~ /^\S/m; return $text; } if (1) { print indent(<<""); Here is some test text with plenty of space and even an indented line at the start }
Outputs:
Here is some test text with plenty of space and even an indented line at the start
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Here documents in blocks
by LanX (Saint) on Dec 19, 2020 at 20:13 UTC | |
by tybalt89 (Monsignor) on Dec 19, 2020 at 20:39 UTC | |
by LanX (Saint) on Dec 19, 2020 at 20:47 UTC | |
by Bod (Parson) on Dec 19, 2020 at 21:56 UTC | |
by LanX (Saint) on Dec 20, 2020 at 02:03 UTC | |
|
In Section
Seekers of Perl Wisdom