Skip to main content




This is my first attempt to create a Perl script.

This script is to convert Markdown files to plain text ones, with some "common" typographic substitutions.

When I finish it, it is assumed to work as follows:

  1. Single-hyphen dashes are replaced with three hyphens: that is, foo - bar is replaced with foo---bar
  2. Markdown-style italic is replaced with Org Mode-style italic: that is, foo *bar* baz is replaced with foo /bar/ baz
  3. Blank lines are replaced with first-line indents, that is:
    ``` FROM THIS This is a 500-character line of text.

    This is another 500-character line of text. ```

    TO THIS This is a 500-character line of text. This is another 500- character line of text.

  4. Lines are hard-wrapped at 72 characters, and additionally:
  5. Any single-letter word, such as "a" or "I", if it happened to be at the end of a hard-wrapped line, unless it is the last word in a paragraph, is moved to the next hard-wrapped line, that is:
    FROM THIS He knows that I love bananas.

    TO THIS He knows that I love bananas.

And now the first draft. Please don't laugh too loudly 😀

```

!/usr/bin/perl


perl -pi -e 's/ - /---/g' $1 # foo - bar to foo---bar perl -pi -e 's/*///g' $1 # foo to /foo/ perl -pi -e 's/\n{2}/\n /g' $1 # blank lines to first-line indents ```

The first two lines work fine.

But I really don't understand why the third line doesn't replace blank lines with first-line indents.

Also, maybe someone can point me to an existing Perl or Awk script that does all of this.

submitted by /u/No-Usual-9631
[link] [comments]



submitted by /u/niceperl
[link] [comments]


Per Context Catalyst Component - John Napiorkowski - TPRC 2024 - Lightning Talk submitted by /u/briandfoy
[link] [comments]


This is not Perl specific, but in our new era of this Perl economy everyone should be thinking about side-hustles and income streams. Perl is perfect for creating SaaS and other services because for efficient practitioners it presents the most efficient way to prototype a lot of things via the web.

For example, shared hosting is dirt cheap and supports cgi-bin; VMs on the cloud are also dirt cheap and you probably don't need more than a $5 instance to POC something that will be good enough to test interest. Knowing more about pricing models is part of that. This is an interesting article about SaaS pricing models, and know more about that is certainly part of creating paid services. Enjoy.

https://garrettdimon.com/journal/posts/data-modeling-saas-entitlements-and-pricing

* sorry the code examples in here are Python, but I think for this purpose we can look past that

submitted by /u/OODLER577
[link] [comments]



Why? (It is on Linux and with utf-8)
perl -CADS -le 'print $ARGV[0]' -- -v=αβγ -v=αβγ perl -CADS -sle 'print $v' -- -v=αβγ αβγ 

submitted by /u/appomsk
[link] [comments]


submitted by /u/niceperl
[link] [comments]


Are there new modern alternatives to PerlNET? I am using a Perl game automation library whose ui is built with Wx using Perl bindings. I want to create my own UI using C#(WPF) so wanted to kno if there are existing solutions to this?

submitted by /u/vizim
[link] [comments]



The Once and Future Perl - Damian Conway - TPRC 2024 submitted by /u/briandfoy
[link] [comments]


If you have some time, read this post over at reddit

https://www.reddit.com/r/bioinformatics/s/lcxEeInCOS

Apparently Anaconda is ActiveStating people and this may very well prove to be a significant issue in the dominance of Python in certain data science fields. Bioinformatics is a very good example of a field that got addicted to Python and the reliance of Anaconda is coming back to bite (the post and the responses raise the prospect of nightmarish scenarios for other environment managers like conda-forge/buoconda). The immediate solution for dependency management is to dockerize everything, but many tools require individual docker containers. If you have to combine more than one of them, chances are that your path will not be a rosy one.

submitted by /u/ReplacementSlight413
[link] [comments]