laziness, impatience, and hubris | |
PerlMonks |
perl 5.32 format questionby hotpelmen (Scribe) |
on May 29, 2023 at 06:46 UTC ( [id://11152452]=perlquestion: print w/replies, xml ) | Need Help?? |
hotpelmen has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
Could you please kindly help with printing empty line into report when using Perl v5.32? Background: while transferring an old Perl application (a collection of scripts) from RHEL7 (Perl 5.16) to RHEL9 (Perl 5.32), found some tests failing in 5.32 because whitespace value refuses to get printed on its own line into report when format uses picture line that starts with caret and ends with two tildes. Removing tildes (or running the following sample code in Perl 5.16) results in whitespace printed on its own line without issues. I wrote the following script for the purpose of illustration of the phenomenon. Note: same behavior is displayed when using "format NAME = ..." syntax instead of "$format = ..." + "eval $format". Running this script as follows prints only lines with non-whitespace values: Expected (and as it works with 5.16): Assuming I still want to use format, how would you advise to overcome this and achieve printing of whitespace values into separate lines of report? I need to keep ~~ there to be able to wrap longer values. It appears that ~~ is confused by Perl with single ~. Any idea WHY the behavior changed? Is it a bug?
Back to
Seekers of Perl Wisdom
|
|