Daily Shaarli

All links of one day in a single page.
Beautiful Perl feature: "heredocs", multi-line strings embedded in source code
thumbnail

A piece of "heredoc" data can appear anywhere in a Perl expression. It starts with an initial operator written either << or <<~. The second variant with an added tilde ~, available since Perl v5.26, introduces an indented heredoc, where initial spaces on the left of each line are automatically removed by the interpreter.

Empty string as delimiter

The delimiter string can also be .. an empty string! In that case the heredoc content ends at the next empty line; this is an elegant way to minimize noise around the data.

Several heredocs can start on the same line, as in this example:

my @blogs = $dbh->selectall_array(<<~END_OF_SQL, {}, split(/\n/, <<~END_OF_BIND_VALUES));

Shell Tricks That Actually Make Life Easier (And Save Your Sanity) | Larvitz Blog
thumbnail

Watch someone backspace 40 characters instead of pressing CTRL+W, and you’ll understand why this list exists.

Hacker News:
https://news.ycombinator.com/item?id=47525243