Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Problem with escape sequence \x for hex with spaces "\x{ 263A }"

by LanX (Saint)
on Jun 10, 2022 at 20:55 UTC ( [id://11144670]=note: print w/replies, xml ) Need Help??


in reply to Re: Problem with escape sequence \x for hex with spaces "\x{ 263A }"
in thread Problem with escape sequence \x for hex with spaces "\x{ 263A }"

Hi Ken,

> hat feature was introduced in v5.34

Thanks, I'm feeling stupid now.

I'm having the newest available Strawberry Perl 5.32 installed and didn't think about the perldoc being even newer.

> It's not mentioned in perlop, so a doco omission

I searched for "version" in perlop and there are many mentions of differences to older Perl.

Not sure if this is always done, but I certainly would have preferred seeing a "(since v5.34)" somewhere.

And I found the description rather cryptic too.

  • but shows optional blanks inside and adjoining the braces
shouldn't it rather be "ignores" or "tolerates blanks"?

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

  • Comment on Re^2: Problem with escape sequence \x for hex with spaces "\x{ 263A }"

Replies are listed 'Best First'.
Re^3: Problem with escape sequence \x for hex with spaces "\x{ 263A }"
by choroba (Cardinal) on Jun 10, 2022 at 22:50 UTC
Re^3: Problem with escape sequence \x for hex with spaces "\x{ 263A }"
by pryrt (Abbot) on Jun 10, 2022 at 21:01 UTC
    shouldn't it rather be "ignores" or "tolerates" whitespace?

    My suggested phrasing would be on "but allows° optional blanks between the braces and the hex value"

    (And whether I said "blanks" or "spaces" or "horizontal whitespace" or "whitespace" would probably depend on whether tests show that it allows only space, or any horizontal space, or any horizontal or vertical space. Like you, I only have Strawberry so limited to 5.32 and cannot test the feature.)

    update: °: Rereading the original, I think they intended that sentence to mean the equivalent of "This second example of the syntax means the same as the example above, but shows the optional blanks that are allowed..."

      The footnote defines "blanks" as tab or space, so "\n" shouldn't be allowed.

      Blanks (tab or space characters) may separate the number from either or both of the braces.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

        The footnote defines "blanks"

        And you even quoted that footnote already, so in theory, I should have read it. It's apparently too late on a Friday for my brain. ;-)

      > update: °: Rereading the original, I think they intended that sentence to mean the equivalent of "This second example of the syntax means the same as the example above, but shows the optional blanks that are allowed..."

      yes, that's what I'm thinking too.

      They probably copy/pasted it from some p5p-discussions or feature requests, and the context got lost.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

Re^3: Problem with escape sequence \x for hex with spaces "\x{ 263A }"
by kcott (Archbishop) on Jun 10, 2022 at 21:13 UTC
    'I searched for "version" ...'

    On the basis that version notes often look like "introduced in 5.nn", I searched for "34": 8 instances found; none relate to this issue.

    '... but shows ... shouldn't it rather be "ignores" or "tolerates" whitespace?'

    I believe that was intended to contrast with the previous line (\x{263A} vs. \x{ 263A }). Depending on device, browser and font, the difference between \x{263A} and \x{ 263A } may not be all that obvious.

    Regardless, a ninth note (e.g. [9] Introduced in v5.34.0.) would add clarity.

    — Ken

      > Regardless, a ninth note (e.g. 9 Introduced in v5.34.0.) would add clarity.

      Normally I'd say a footnote is overkill, but since there is that note

      Note that any escape sequence using braces inside interpolated constructs may have optional blanks (tab or space characters) adjoining with and inside of the braces, as illustrated above by the second \x{ } example.

      every "escape sequence using braces" should better have this as footnote plus "(since v5.34.0)"

      On a side note, this seems to be in analogy how identifiers inside braces are handled

      DB<70> $a = 42 + + + DB<71> p ${ a } + 42 + DB<72> p ${ a } + 42 + DB<73> p "${ a }" + 42 + DB<74>

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

      > often look like "introduced in 5.nn", I searched for "34"

      None of my hits for "34" had to do with versions.

      But I searched for "5." leading to 40 hits, only 2 were not referring to version diffs.

      So yes, perldoc normally lists such differences.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-20 06:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found