This is what I would expect an example program to look like:
#!/usr/bin/perl use strict; use warnings; print 'A'; # Prints 'A' print chr(65); # Prints 'A' my $c = 65; print chr($c); # Prints 'A' $_ = 65; print chr; # Prints 'A'

I'll assume that you've successfully tested that on your system; however, consider:

So, as you can probably see, there's no one-size-fits-all example. Providing explanations and code fragments is likely to be suitable for a wider audience; even then, many pages require links to perlport or other caveats.

"I will study the GitHub link ... although it's quite messy."

Well, I didn't have any trouble finding the chr() tests for the latest stable release, https://github.com/Perl/perl5/blob/v5.36.1/t/op/chr.t, or those from over a decade ago, https://github.com/Perl/perl5/blob/v5.16.0/t/op/chr.t.

At the end of the day, if you're really struggling with using some function, ask here: we're always happy to help. I would request that you restrict your questions to a single function or related group of functions; listing every operator and function that you can find is just off-putting — many who could otherwise provide insightful responses may simply move on to the next question.

— Ken


In reply to Re^3: How to find Perl demo programs? by kcott
in thread How to find Perl demo programs? by harangzsolt33

Title:
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, details, 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, summary, 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.