summaryrefslogtreecommitdiff
path: root/gemfeed
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2022-12-17 11:17:43 +0000
committerPaul Buetow <paul@buetow.org>2022-12-17 11:17:43 +0000
commit07767b72fae8a7b793b13e7f0bf815939beb9fcf (patch)
tree11f21d56f2b6b27cffaec487b05ac55132b63094 /gemfeed
parentc69bda7b256a7fbe01ec1036e283a097985bed93 (diff)
Update content for md
Diffstat (limited to 'gemfeed')
-rw-r--r--gemfeed/2022-05-27-perl-is-still-a-great-choice.md8
1 files changed, 6 insertions, 2 deletions
diff --git a/gemfeed/2022-05-27-perl-is-still-a-great-choice.md b/gemfeed/2022-05-27-perl-is-still-a-great-choice.md
index 6a7966d8..9c75c661 100644
--- a/gemfeed/2022-05-27-perl-is-still-a-great-choice.md
+++ b/gemfeed/2022-05-27-perl-is-still-a-great-choice.md
@@ -1,6 +1,6 @@
# Perl is still a great choice
-> Published by Paul at 2022-05-27, last updated at 2022-12-10, Comic source: XKCD
+> Published by Paul at 2022-05-27, last updated at 2022-12-17, Comic source: XKCD
[![./2022-05-27-perl-is-still-a-great-choice/regular_expressions.png](./2022-05-27-perl-is-still-a-great-choice/regular_expressions.png)](./2022-05-27-perl-is-still-a-great-choice/regular_expressions.png)
@@ -104,7 +104,7 @@ Here are some reasons why not to chose Perl and look for "better" alternatives:
## Why all the sigils? It looks like an exploding ASCII factory!!
-The sigils `$ @ % &` (where Perl is famously known for) serve a purpose. They seem confusing at first, but they actually make the code better readable. `$scalar` is a scalar variable (holding a single value), `@array` is an array (holding a list of values), %hash holds a list of key-value pairs and `&sub` is for subroutines. A given variable `$ref` can also hold reference to something. `@$arrayref` dereferences a reference to an array, `%$hashref` to a hash, `$$scalarref` to a scalar, `&$subref` dereferences a referene to a subroutine, etc. That can be encapsulated as deep as you want. (This paragraph only scratched the surface here of what Perl can do, and there is a lot of syntactic sugar not mentioned here).
+The sigils `$ @ % &` (where Perl is famously known for) serve a purpose. They seem confusing at first, but they actually make the code better readable. `$scalar` is a scalar variable (holding a single value), `@array` is an array (holding a list of values), `%hash` holds a list of key-value pairs and `&sub` is for subroutines. A given variable `$ref` can also hold reference to something. `@$arrayref` dereferences a reference to an array, `%$hashref` to a hash, `$$scalarref` to a scalar, `&$subref` dereferences a referene to a subroutine, etc. That can be encapsulated as deep as you want. (This paragraph only scratched the surface here of what Perl can do, and there is a lot of syntactic sugar not mentioned here).
In most other programming languages, you won't know instantly what's the "basic type" of a given variable without looking at the variable declaration or the variable name (If named intelligently, e.g. a variable name containing a list of socks is "sock_list"). Even Ruby makes some use of sigils (`@`, `@@` and `$`), but that's for a different purpose than in Perl (in Ruby it is about object scope, class scope and global scope). Raku uses all the sigils Perl uses plus an additional bunch of twigils, e.g. `$.foo` for a scalar object variable with public accessors, $!foo for a private scalar object variable, `@.foo`, `@!foo`, `%.foo`, `%!foo` and so on. Sigils (and twigils) are very convenient once you get used to them. Don't let them scare you off - they are there to help you!
@@ -122,6 +122,10 @@ Btw.: Did you know that the first version of PHP was a set of Perl snippets? Onl
[https://www.perl.org](https://www.perl.org)
+> Update 2022-12-17: The followingf is another related post. I don't agree to the statement made there, that Python code tends to be more compact than Perl code, though!
+
+[Why Perl is still relevant in 2022](https://stackoverflow.blog/2022/07/06/why-perl-is-still-relevant-in-2022/)
+
E-Mail your comments to paul at buetow dot org! :-)
[Go back to the main site](../)