Skip to content

Conversation

@jidanni
Copy link
Member

@jidanni jidanni commented Feb 16, 2023

Users need to understand that their $2 etc. might not be defined always. I don't think this has been explicitly documented anywhere. Indeed, one could go on to mention (((.?)?)? ...

Users need to understand that their $2 etc. might not be defined always. I don't think this has been explicitly documented anywhere. Indeed, one could go on to mention (((.?)?)? ...
@demerphq
Copy link
Collaborator

demerphq commented Feb 16, 2023 via email

@Grinnz
Copy link
Contributor

Grinnz commented Feb 16, 2023

I would agree this is a bit out of place. The documentation for $1 etc in perlvar states that they are only set on successful matches.

@demerphq
Copy link
Collaborator

I'm pretty sure the perlvar docs do explain the difference between (X?) and (X)? -- it comes down to (X|) vs (?:(X)|)

@jidanni
Copy link
Member Author

jidanni commented Feb 16, 2023

Well I was just thinking beginners will be reading perlre before
perlvar.

 /^(?:([\d.])+ mi w of )?SE cr Sec\s+(\d+)\s+T129N\s+R(\d+)W\s+N\s+Dak$/; my $u = $1 ? $1 : 0; # And will have added this safety line of code... print "$input: Mon ", ( $3 - 48 ) * 6 + 4 + ( 36 - $2 ) + $u, "\n"; 

...because they have been stung too many times about this thing that has
never been extra clearly documented.

But sure, somebody please mention something more than there currently
is somewhere.

@Grinnz
Copy link
Contributor

Grinnz commented Feb 16, 2023

If anything, I think several references in this section should be updated with links to the appropriate perlvar sections.

@demerphq
Copy link
Collaborator

Id prefer if you reworked this to reference perlvar.pod instead. I might give it a go myself if you dont want to, but im not comfortable with this wording and i think the best thing would be to direct people to the other doc.

@jidanni
Copy link
Member Author

jidanni commented Feb 19, 2023

Yes, I can guarantee my wording is bad (I failed perl 101. Don't even know what objects are.)
I'm just hoping someone will rework it and mention something somewhere.

@demerphq
Copy link
Collaborator

This is supplanted by #20823.

Thanks for the contribution, but I am going with my own more comprehensive rewrite. Please review the changes there. Thanks for the motivation to improve this.

@demerphq demerphq closed this Feb 19, 2023
@jidanni jidanni deleted the patch-1 branch February 19, 2023 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants