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]



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]



Although this StackOverflow question about "islands and gaps" is titularly about Perl, the SQL answers are very nice. Apparently this is a FAQ for SQL.

However, this has bugged me for years on the CPAN side, but never enough to make me really do anthing about.

I thought there was a Perl module that did this, and it was in the context of a usenet reader that would take a list of article IDs, such as 1, 2, 3, 4, 5, 7, 10, 11, 15 and return something like 1-5,7,10-11,15 as a more space-efficient store of all the articles you had read.

Every time I've looked I've stopped after 15 minutes because I get distracted and I've never really needed this except to answer someone else's question. I'm not asking how to solve this because there are plenty of algorithm tutorials out there. Surely this is on CPAN somewhere.

There are plenty of options to go the other way and to ask if a number is in one of the ranges.

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





I have a Mac M1 chip laptop.

While I have managed to install a couple of modules, most fail to install.

I tried perlbrew, but that was a struggle to even get it to install perl itself, but when it was installed it wasn't working the way I needed it to.

Just wondering if I am missing something with CPAN or if this is an issue because it's an M1 chip?

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