Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

A simplistic view of what constitutes a legitimate identifier is any name that matches the following regexp:


But this has many shortcomings, some of which are described in a StackOverflow article from tchrist (When I read his articles dealing with Unicode I mostly just feel small). It doesn't allow for most punctuation variables described in perlvar, for example... but even discounting those, it's just a start.

I mention this because the symbols you are using in your identifier will not match that regular expression, despite ID_Start and XID_Continue matching well over a hundred thousand characters. And these aren't punctuation characters described in perlvar either. So for typical use you can probably disqualify them outright.

One thing of note is that when wielding symbolic refs, nearly any set of characters is legal, including your currency symbols. Case in point:

use utf8; binmode STDOUT, ':utf8'; no strict 'refs'; my $symbol = '1%^@"'; $$symbol = 42; print "\$$symbol = $$symbol\n"; print "$symbol is found in package ", *{__PACKAGE__ . '::1%^@"'}{PAC +KAGE}, "\n"; print "\$main::${symbol} has a value of ", ${'main::1%^@"'}, "\n";

Spoiler alert, it works. And notice we're using the and characters.

Symbol manipulation is something Perl is good at, but that we try to avoid for our own sanity. A language that more fully embraces it is Scheme. And since symbol manipulation is the name of the game for Scheme, naturally that language is fine with as a function identifier:

(define (lambda (x y) (+ x y))) ;Value: || 1 ]=> ( 3 5) ;Value: 8


In reply to Re: Currency symbols in variable names by davido
in thread Currency symbols in variable names by pme

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (3)
    As of 2020-10-25 09:20 GMT
    Find Nodes?
      Voting Booth?
      My favourite web site is:

      Results (249 votes). Check out past polls.