Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^4: Hash key composition with a comma? (Semipredicate problem)

by LanX (Archbishop)
on Mar 17, 2018 at 22:19 UTC ( #1211165=note: print w/replies, xml ) Need Help??


in reply to Re^3: Hash key composition with a comma?
in thread Hash key composition with a comma?

It's a variation of the Semipredicate problem.

Another variation are Null-terminated strings in C. *

In other words, if you use a "special" value (here the delimiter) you have to make sure that the input (here keys) can't include them, and that's why you even have the freedom to chose the delimiter by setting $;

Such approaches happen constantly in programming and people make sure that such values are excluded, IFF they need the benefits. (For example by escaping or the choice of delimiter in q , qq or even << here-docs.)

Calling for deprecation doesn't make sense here, since one doesn't easily and accidentally stumble over this feature.

It's similar to goto , it's rarely used, doesn't cause problems, but is sometimes extremely handy to simplify an algorithm, where speed matters.

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

*) and yes I once got bitten by this because a badly written WMLScript interpreter couldn't distinguish between a NULL byte and the ASCII character "0". But this interpreter was buggy, there was otherwise no possibility to introduce a NULL-byte into a string.

  • Comment on Re^4: Hash key composition with a comma? (Semipredicate problem)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2019-09-20 01:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The room is dark, and your next move is ...












    Results (253 votes). Check out past polls.

    Notices?