Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: perl 5.32 format question

by haukex (Archbishop)
on May 29, 2023 at 12:15 UTC ( [id://11152460]=note: print w/replies, xml ) Need Help??


in reply to perl 5.32 format question

I reduced your code down to this test case: perl -e '$_=" "; formline q{^<<<~~}, $_; length $^A or die' and a bisect reported that "9b4bdfd4 is the first bad commit". This is a commit that fixes several bugs in formats; it was first released as part of Perl v5.20.0 9 years ago.

If you read the documentation, note that a double tilde means "the line will be repeated until all the fields on the line are exhausted, i.e. undefined", however, a single tilde "anywhere in the line" means to suppress "lines where all fields are blank". Although I think the documentation could be a lot more clear on this (Update: patch applied), a double tilde implies the single tilde, as is confirmed by the relevant code in Perl 5.0.0 and today.

Anyway, the following provides your expected output both on older and recent Perl versions (tested on 5.14 to 5.36):

format REP = ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $rep_line ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~ $rep_line .

Replies are listed 'Best First'.
Re^2: perl 5.32 format question
by hotpelmen (Scribe) on May 30, 2023 at 15:59 UTC
    Thank you very much, haukex for your prompt and informative response as well as for submitting the patch to enhance the documentation. The format you suggested worked beautifully.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11152460]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-24 18:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found