I Found Out When I Started Learning Perl
1 direct reply — Read more / Contribute
|
by rje
on May 08, 2021 at 20:55
|
|
|
I found my old status reports from work, many moons ago, and I found some gems there, but by far this is the most significant one.
From the 1994 Week 24 status report:
Last week's achievements
========================
- MCPS
- attended Tiger meeting.
- attended M.Carlock's Ofc Parm meeting.
- did LTCINV Table Tiger Team Timings.
- began learning PERL.
^^^^^^^^^^^^^^^^^^^
This week's goals
=================
- MCPS
- think about the MFA pre-development meeting issues & questions...
- rewrite my old tools in PERL (for practice).
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- harass M.Gyger re Vacation Request.
|
Perl Contempt in My Workplace
17 direct replies — Read more / Contribute
|
by rje
on Apr 26, 2021 at 19:32
|
|
|
The attitude around work is strongly "don't use Perl", in an informal way. It's not an official position, and there's been no talk that I know of about not allowing Perl in the workplace. There are a couple of key scripts that can't be replaced until we move completely into a container-based deployment model. So Perl is officially supported, for now.
That doesn't stop people from putting up style guides for various tools and toolsets in the company, and having a page for Perl that simply says:
Don't use it.
If you have to use it, use strict and use warnings.
But seriously, don't use it.
Use Python.
It's hard for me to rise above this attitude problem. They've gotten it stuck in their heads that Perl is just a spaghetti has-been language and that Python is "all that".
I do what I can... but we all know that story. I write good Perl, I instruct and inform people of good Perl that I've written that does useful things.
But I have a problem: I identify with Perl. I care about it, because it not only was part of my career identity for 20 years; I LIKE Perl and think it does many things better than other languages.
I'm biased. And it offends me that others are so openly contemptuous.
I need thicker skin. What's the best way to get thicker skin about Perl's unpopularity?
I was having an okay day until I saw this blatant display of contempt and smugness.
|
The rookie drama
4 direct replies — Read more / Contribute
|
by hrcerq
on Apr 24, 2021 at 21:18
|
|
|
The rookie drama
At some point in time, everyone's been a beginner. There's no shame
in being one. By contrast, I'd say there's shame in pretending not to be
one. These days I was thinking about a matter related not just to
learning Perl, but actually related to learning many things.
And just to be clear, I still consider myself a Perl beginner, as
even though I started my learning path about 2 years ago, I've only used
perl for trivial tasks and for many months didn't touch a single line of
Perl code, until last month.
Actually, I'd say I'm proud of being one. The beginning is one of the
most enjoyable stages of the learning path (as it should be), if you
really take your time to appreciate it. It lessens the burden of having
to know some complex details, though it's not to say you don't have the
obligation to read docs and do some researching before you ask for help.
I believe the newness of a subject to be motivating (note that I'm
referring to newness as "something new to someone", not as "new
on itself"). Exploring on something new, that might be helpful (and in
the case of Perl, it certainly will) should be enough to get you into
learning something.
Why do people hurry?
I must confess that many times I found myself in a hurry to leave
this awesome (beginning) stage behind, as I've seen many people doing
the same thing. I now believe that to be a mistake. If you don't take
your time to enjoy each step in a learning path, then it's like getting
to the top of a cards pyramid. Just a wind blow and everything falls
apart.
But then I thought to myself: "Why do people do that? Why do people
hurry?" Well, I believe I can figure out some of these motivations, as
they have crossed my mind many times. I'll be a bit Perl-specific here,
but much of these considerations apply to other subjects too.
Fear of being discredited
When you're learning a complex subject such as a programming
language, you might feel like much of what you're doing is wrong, simply
because you've never had the time to learn how to do proper. That could
lead you into thinking: "if someone experienced sees this, I'll become
a joke".
You may also feel discouraged to contribute and say things about Perl
because then something might be wrong or imprecise and someone could say
something like "just stay quiet, you're nothing but a stupid newbie".
Though not with these words (and not Perl-related), I've seen people
act like that.
Being subject to this is not cool, and that certainly makes you wanna
hurry to learn. And that's a bad motivation, because then your primary
goal is not to learn, but not being bullied. When learning is secondary,
you skip important stuff.
Just a hunch: bullies are probably newbies too. They're just so
afraid to admit it, that they act like this. But even when they know
what they're talking about, if they're using knowledge to embarass you,
then it's shame on them, not you. They're driven by vanity alone and not
the desire to help.
You, on the other hand, can always avoid vanity and not let that be
an obstacle. If you know upfront that people might mock you (even when
you're right) and yet you put your learning or contributing before that,
then you'll be fine.
Let's just not confuse bullying with pointing the right direction, as
some bad practices should be carefully and helpfully described, so
they're not repeated.
Job related considerations
Perl-related jobs still exist, of course, but they've had more
popularity in the past. For those who enjoy Perl programming, it may
seem like a good idea to convince your boss that you know a lot about
it, so that it's incorporated in your workflow.
And that is probably going to fail (miserably). If you want Perl to
get some credit where you work, I believe your best chances are showing
that it can help getting things done, and yet you don't depend on it.
And please, don't take that last part as an afterthought. The idea of
depending on something like Perl is probably terrifying to your boss.
Like nightmares-grade terrifying. Saying you're an expert doesn't help,
as it may seem like you need to be an expert to get things done.
Now, if your company already uses perl, you might feel tempted to
pretend you know more than you do. That's also a mistake, as you might
be convincing, in which case you'll be put to face tasks you're not
prepared for, or you might not, in which case you could face some
(deserved) discredit, or even be fired, so don't do that.
So many nice docs and tutorials
One of the great virtues of Perl is the amount of high-quality
documentation available, as well as books, tutorials and specialized
blogs. There's so much to read, you may feel like you'll never finish
your reading.
And in fact you probably won't. But that souldn't make you hurry.
Reading just for the sake of reading is a complete waste of time. You
won't learn anything by doing that, so either take your time to read
properly, or don't read at all. In other words, hurrying just doesn't
work.
Of course, you'll need to be selective. As time is a scarce resource,
you need to prioritize what's best and most needed. This is where a
community shines. A community (such as PerlMonks) may help curate
material that's more appropriate for a beginner. As your learning goes,
you'll be more proficient in choosing what's worth your time.
It may seem like shorter tutorials or explanations should be taken
first. That's not necessarily so. Often times, taking your time to read
a more comprehensive document or book might pay off and help you absorb
with more ease the further documentation you come across.
Shorter articles/books might be good if they are concise, but not if
they are simplistic, in which case you should just ignore them. Again,
with the help of a community it might be easier to choose what's worth
your time.
In that regard, I can say the
tutorials here in
PerlMonks greatly helped me. For instance, I've been doing some review
on context and scoping rules, and found great articles on that. These
are foundational concepts in Perl and having a good explanation on them
has been very helpful. The same goes for many other concepts.
Now, even avoiding useless stuff, you'll most likely miss a lot of
good reading too. It's just too much for not so much time. Not being
able to read today something you really want to is frustrating, but
there's always tomorrow. Here's where you exercise your patience.
The power of a community
As I've mentioned, a community helps a lot in curating your studying
materials, but not only that. A community also may encourage you to
keep improving yourself, giving feedback, proposing new challenges, and
actually merely talking about a subject helps you keep motivated.
So, this is what brought me to PerlMonks. Much is said about CPAN
being one of the greatest features of Perl, and certainly I agree, but
I also believe PerlMonks is a feature many other languages lack.
In fact, CPAN itself is a community effort, and I believe that's one
of the reasons it's so much appreciated by perl users. Of course, it
wouldn't do much good if it didn't help us get things done, but the
community thing is core to CPAN's existence.
Getting help from a community may be rewarding, but, at least for me,
giving back is even more rewarding. Even when it's a very small
contribution. We have limitations after all, but we can always do
something.
Some things just take time
No matter how hard you try, some things take time. Accepting this
fact may be liberating. Again, each step in a learning path should be
properly appreciated. The beginning should be the most exciting part of
the process, and here's good news: each step is a new beginning.
There's too much hype on being an expert on anything. Becoming an
expert should be considered a good thing, of course. But what happens
when it's so much desired and beginning is so underappreciated? You try
to hurry (and gets frustrated, as it doesn't work).
Aside from that, there are too many "fake experts" out there. People
who, as I said, are driven by vanity (and lazyness too). When you act
like that you may fool some unwary people sometimes, but don't fall for
it, you'll be unmasked sooner or later.
You shouldn't hurry, but if you do, make sure that learning is your
primary goal, and not something else. In fact, I believe some other
languages are far more popular than Perl just because they have much
more immediate pressing concerns involved, that have nothing to do with
learning.
And remember, this piece of advice comes from a beginner. As such, I
know there's people out there who could say a lot more on this subject.
Yet, that didn't prevent me from trying to contribute. For me, that's
the spirit in a community. And you don't have to take my word for it,
but if you came to the end of this post, then I believe you're at least
willing to try.
|
File lock demo
6 direct replies — Read more / Contribute
|
by LanX
on Apr 21, 2021 at 12:25
|
|
|
Hi
I needed to use flock and found the docs confusing and the demo code slightly dangerous ( lock is another builtin for threading)
So I hacked a demo script, where only one instance will count from 1 to 10 when simultaneously running.
On windows you can start 4 simultanous instances from CMD with
> start perl demo_lock.pl & start perl demo_lock.pl & start perl demo_
+lock.pl & perl demo_lock.pl
The first three scripts will pop up in separate windows which you could/should arrange to be visible.
Have fun! :)
|
[RFC] Module code and POD for CPAN
6 direct replies — Read more / Contribute
|
by Bod
on Apr 13, 2021 at 17:27
|
|
|
Having needed to implement a simple workflow for taking card payments by Stripe and knowing that I need to do the same again soon for a different product set, I have created a module that I think will be useful to other people. Existing modules to connect with Stripe either do not cater for the latest security measures of 3D card payments in Europe or are a wrapper for the Stripe API. Both of which are, of course useful. But I wanted to create something easy to use that can be used for the typical simple workflow required by many small businesses.
This gives a simple workflow of adding products to a 'Trolley' and then sending the user directly to the Stripe hosted checkout. From there, Stripe returns to either a success URL if payment was taken successfully or a cancel URL if, for any reason, the transaction failed.
Could you please provide me with some feedback regarding both the code and the POD ahead of uploading it to CPAN?
I was thinking Business::Stripe::Simple as the module name - is that sensible?
Note - at the moment, the examples in the documentation have not been tested. They will be before uploading!
Thank you to the Monks who have helped me develop the skills to get the module this far and to the ones who will give useful feedback.
It is very much appreciated.
UPDATE:
I have run the code through Perl::Critic and it passes at 'stern' but generates warnings at 'harsh'. One thing it has found are tab characters instead of spaces despite changing my editor to use spaces after this discussion. I will take out the tabs that have crept in from copying and pasting a few bits of code.
On the suggestion of Critic, I have moved the declaration of $VERSION to after use strict;. Although I thought that had to be first for the CPAN toolchain?
|
How should Perl revolve?
5 direct replies — Read more / Contribute
|
by xiaoyafeng
on Apr 11, 2021 at 02:00
|
|
|
Recently, P5P is arguing about the future development of Perl. As a long-term user of Perl (but not a core developer), I also have some ideas of my own.
The first and most important question is, what are Perl's real capabilities / advantages? sigil? Regexp? On some degree, yes, but not exactly. Perl's real power lies in its expressive power and self-evolvement. Language is language, and computer language is also a kind of language (although many people don't realize it now). The purpose of language is to communicate and express what they want to express. At the beginning of Perl language, Larry learned from many excellent functions of the language, so it can let people express what they want quickly accurately, which is the real reason why Perl stands on the river. So I conclude below by learning history of other languages(including human languages):
-
When the language can't deliver what it wants to deliver quickly, there will be fewer and fewer users stay there, such as COBOL, lisp, Latin (human language), even if they have many bright spots.
-
Without users, the language will die. In history, many languages have died out, they may have many advantages and characteristics, but now these characteristics may exist in other languages, but they themselves have died out.
-
The language needs to quickly implement the features it needs, not whether it is elegant or not. Think about Japanese, Chinese, and even English. In the long history, they constantly learn from other languages to implement some new concepts. These implementation may conflict with their own, but it doesn't matter. As long as they can quickly accurately deliver these new concepts to achieve the purpose of communication, the language will not die. Languages that have been slow to implement new functions for the sake of elegant implementation (or because of lack of manpower) have all died out.
Let's go back and see how Perl should do? In recent years, Perl supporters have said that the advantage of Perl is CPAN (stand on the shoulder of cpan). what does it really mean? It means that Perl also has all the functions and libraries which other languages have(though there is maybe not in Perl itself)
Unfortunately, I personally feel that the core developers of Perl seem to have lost the direction of Perl(perhaps because of the stepdown of Larry?). They are addicted to deprecate the old functions instead of adding new functions and facilitating cpan developers. This leads to several severe problems to perl:
-
More and more modules on cpan are not available, and even many authors give up their own modules because they want to adapt to new changes
-
Because XS and its toolchain are too specific to C language and Perl, it is difficult for people who are not familiar with Perl to develop interface libraries. Think about UV, such a popular library needs people like PEVANS to maintain.
-
Due to the lack of new functions or new libraries, Perl has fewer new users, such as GUI and parallel programming. This is a vicious cycle. Due to the lack of language functions and the complexity of language level, fewer and fewer people use Perl. Therefore, there are fewer and fewer heavyweight modules in cpan, resulting in fewer and fewer people using Perl. It should be understood that the difficulty of learning the language itself is never the first thing for users, but the function is. As long as you have the features users want, no matter how difficult, they will learn.
I admit that due to the lack of core developers, it is more and more difficult for Perl to implement new functions. Thus, I think the short goal of core developers should be how to make it convenient for cpan authors, especially some tools for quickly borrowing features/libraries from other languages. Imagine the real language, there are many words in English, which are borrowed directly from French, Japanese and many more. Some words have never been officially deprecateded. But the real function is used naturally, the bad function is put there, the user slowly becomes 0!
To sum up, I suggest that the core developers of Perl should be able to focus on (of course, this is only my personal wish) redesigning and implementing a language layer for communication with other languages. The current XS and its toolchain are too limited to C and obscure which makes it difficult for the user to develop such an interface.
In addition, the layer between languages should not be limited to compiled languages, but also include virtual machine languages and other specifications(consider how many ppl on windows use Win32::OLE). Because we are short of developers, when a new popular application or library appears in other languages, it may be difficult for us to have the corresponding Perl version very quickly. If there is a convenient way to establish a conversion layer at this time, so that Perl users can stay in the Perl world happily, I think it is great incentive for the use of Perl! FFI:: Platypus does very well. I hope it can enter the official package when it's mature. but I also want it could be more ambitious. to introduce more virtual machine languages, including C sharp, node.js , GO, etc. Inline:: XX may also be a direction, but it seems too duplicated to need to write its parsers for each language.
Of course, in the long run, of course, P5P can slowly polish the Perl language itself, maybe including type system, object system, better regexp, concurrency programming, etc. but it should be noted that language and its new features need to be learned by users. First of all, users should stay in Perl, without users, language and its features can not prove whether they are useful or not.
UPDATE:
Thanks for Discipulus, GrandFather pointing out my various English mistakes. ;)
I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction
|
"Magic tools" that take the fun away
6 direct replies — Read more / Contribute
|
by hrcerq
on Apr 08, 2021 at 16:18
|
|
|
Hi, folks.
Recently I've found (here in PerlMonks) a link to one of Donald Knuth's great talks: Computer Programming as an Art. Knowing it was Knuth's sutff, I knew it would be worth my time.
One of the (often overlooked) benefits of computer programming is that it can be fun. But Knuth goes beyond that stating that it should be fun and that a program should be beautiful. Fun and beauty add a lot of value to the program and to programming.
Now, at the same time, observing the IT industry as whole, we can see how much the fun and beauty of programming are being overlooked. More and more "magic tools" are making way to sysadmin jobs, and they're focused on people who don't want to program. IT managers often see them as a means "not to depend too much on programmers". It's laughable, but I've seen it a lot.
One example of such tools are the configuration management tools, such as Ansible, Puppet, Chef and similar tools, which take a more declarative approach to systems management. I'm not saying these tools aren't useful (or even that they are necessarily bad), but I feel like they've taken a lot of the fun away from systems management.
This is not to mention GUI-only tools, which are mostly closed-source. Fortunately I've been far from them. But currently at my job, I help maintain some Ansible routines, and sometimes it's a daunting task. I can't remember how many times I had to grep a repository to find out when some variable was being set. If a declarative approach should be friendly, then I must say it has failed in my case, because the repository I work with has grown into a messy beast (I'm sure my co-workers agree).
Yet, I remember once I've put a perl one-line command in a playbook and was critized precisely for this action. I was told it would bring complexity and that other people would have difficulty maintaining perl code. Can you believe it? A one-line! I'd say it's a joke if someone else told me.
Of course, I wouldn't give up on Perl because of that. But it makes me wonder why must we always prove something that exists for decades is worthy a try, while something created a few years ago is promptly accepted. Of course, it's just my point of view, which not necessarily happens everywhere. Other points of view would be much appreciated.
|
How old is too old?
4 direct replies — Read more / Contribute
|
by Bod
on Apr 08, 2021 at 16:01
|
|
|
Over on Re: How Xerces validation access http schemas ?, hippo wrote "It's worth noting that the most recent versions of XML::Validate and XML::Xerces are from 15 years ago and may not play so well with modern systems". This immediately reminded me of a recent search for modules to connect with PayPal where I found Business::PayPal::IPN but didn't look any further than the date which is AUG 19, 2003.
Clearly for things that connect to frequently evolving APIs, being quite up to date is pretty important unless the API allows use of a particular past version. But for things that don't change much, like XML, the need for recent updates is less apparent. As hippo puts it, they need to "play well with modern systems".
So, when deciding whether to use a module, or anything else for that matter, how old is too old?
|
[RFC] What is [pP]erl to you, and how has this changed for you over the years (if it has)?
3 direct replies — Read more / Contribute
|
by perlfan
on Mar 31, 2021 at 18:22
|
|
|
I'm just as curious about the value of this exercise as I am the answers, but I wanted to request something. Originally, I wanted to as, is perl a unix utility or is it a language?. Then I realized, this has many dimensions and I'd rather not beg the continuum of answers upfront; but it's worth at least sharing this point. Anyway, this seems especially timely given the recent discussions on p5p and elsewhere about a whole lot of things related to [pP]erl.
Some politely requested ground rules:
- refrain from replying to anyone else (except OP)
- please don't ++ OP, I'm not doing this for XP (-- if you must, that's not the ask)
- upvote replies, this provides information/consensus
- refrain from downvoting sincere replies, even trolls/rants (for real)
- focus on your own perspective (this is not currently a debate or zero sum game)
- feel free to post anonymously
- post only once, feel free to edit/update your node as much as you want
Okay, so why am I doing this? For the children. (Seriously, I have a follow up about "the future"; but be patient). I'll probably give that in a few weeks. TIA
|
[RFC] Review of module code and POD
6 direct replies — Read more / Contribute
|
by Bod
on Mar 31, 2021 at 15:45
|
|
|
Esteemed Monks,
For all past time we have connected directly to our CRM from the scripts that need to read or write the data. It has been my intention for a very long time to create some standard subroutines in a require file to do all the things we regularly need to do. Thanks to The Monastery, I now know I need to use a module to do this. So I have set about creating a suitable module. I also thought this would be a good opportunity to do it properly and include some POD. This module will never be used outside of our use case but it seems like good practice to include documentation.
Could you please look over the code and documentation and for me before I go too much further and advise if I am making any horrible mistakes, what I can improve and how clear the documentation is...
I have pulled out anything that could pose a security threat to Bod::Variables. Not just database username and password but also schema name and table names.
The documentation as generated by pod2html is here.
|
I just had to share this (Quora comment on Python)
2 direct replies — Read more / Contribute
|
by ait
on Mar 29, 2021 at 13:49
|
|
|
As I was reading some random old thread on "Why is Python so bad?" I came across this comment which I think reflects why I love Perl so much:
Sudhir Sudhir
July 29, 2019
Python is considered bad because it suffocates you to death while being deaf to the prey’s death cries. It falls on you unexpected from the top of a tree and before it swallows you it has to crush your bones and make you a sack of pulp for easier consumption. Very painful. Won’t recommend at all. It’s not venomous, so you have no option of getting hallucinations through the painful experience before death either.
|
New RFC for CSV in the pipeline
1 direct reply — Read more / Contribute
|
by Tux
on Mar 16, 2021 at 09:07
|
|
|
I wonder how much code would break if all of what RFC 4180bis proposes would be blindly implemented by parsers.
I bet there are tons of CSV files out there that are not UTF-8 and/or do not follow BOM correctly or are real binary to start with.
And what about point 8:
A hash sign MAY be used to mark lines that are meant to be commented lines. A commented line can contain any whitespace or visible character until it is terminated by a line break (CR, LF or CRLF). A comment line MAY appear in any line of the file (before or after an OPTIONAL header) but MUST NOT be mistaken with a subsequent line of a multi-line field. Subsequent lines of multi-line fields can start with a hash sign and MUST NOT interpreted as comments. For example:
#commentCRLF
aaa,bbb,cccCRLF
#comment 2CRLF
"aaa","this is CRLF
This would require new options in all parsers to reject lines that start with a #.
As Text::CSV_XS already implements/supports all other options, I wonder if there would be enough motivation to add attributes to recognize/skip comments (which would also require a new config variable that contains the comment lead-in (#, // sprint to mind) and if a leading comment string would only be valid if followed by whitespace (probably more things to consider). This would also mean impact on strict as comments (and empty lines) will, per definition, nog have the same number of fields as the rest of the data.
Ideas welcome as usual.
Enjoy, Have FUN! H.Merijn
|
RFC: Kinda pseudo-shuffle using sort
3 direct replies — Read more / Contribute
|
by rsFalse
on Mar 15, 2021 at 05:58
|
|
|
Hello.
I'd like to share my observation how to shuffle an array with Perl's sort. This shuffle is far from perfect, and the result of shuffle isn't uniform. But may it be useful for someone.
!!! UPD. Using sort subroutine in that way is NOT RECOMMENDED! See further comments. ikegami and haukex provided explanation and cited documentation. !!!
Code:
@array = sort { 0.5 <=> rand } @array;
Perl's default sort algorithm is mergesort (perlsec: Algorithmic Complexity Attacks) from 5.8.0 version (Although there may be some optimizations or different behavior if an array length is less than 18? e.g. RFC: Simple switches for 'sort' and list 'reverse').
How does it work? Sort subroutine ignores values of both elements of a pair to compare, i.e. we don't use bindings: nor $a neither $b. Just a constant and rand() function. Here rand() produces some number from an interval 0 to 1 and compares it to a constant (i.e. 0.5). And the "spaceship" operator returns either -1, either 1 (hence with 0.5 probability). Then sort, depending on subroutine's value, changes positions of elements of a pair.
How the results obtained with this sort subroutine differ from uniformly shuffled array, e.g. Fisher-Yates shuffle?
|
Anyone interested in old Perl Journal and Perl Review magazines?
2 direct replies — Read more / Contribute
|
by iguanodon
on Mar 10, 2021 at 18:34
|
|
|
Hi Monks, is anyone interested in old Perl Journal and Perl Review magazines? I will be moving and don't want to move these, again. I think I have a complete set of both:
- The Perl Journal: 22 issues, spring 1996 through fall 2001
- The Perl Review: 18 issues, winter 2004 through spring 2009
I would rather give these away than throw them in the recycle bin. I'd prefer to give them to someone who will take one or both complete sets but if there is nobody interested in that I will send individual issues. If you will take a complete set I will ship them to anywhere in the US, free to a good home. Outside the US, let's talk :) .
|
RFC: Simple switches for 'sort' and list 'reverse'
2 direct replies — Read more / Contribute
|
by rsFalse
on Mar 05, 2021 at 11:32
|
|
|
Upd. I slightly changed a node name and rewrote a section about reverse (older text is under strikethrough and moved to the end of the post).
Rarely we want to do something the same with both: with original and reversed list, or with original and sorted (and sorted backwards) list. Here you will find few examples how to use a simple switch to turn ON/OFF sorting or reversing list.
sort: Say we want to apply some function on original, sorted, and sorted backwards list. Example program:
my @original = ( 5, 'A' .. 'C', 0, 4 );
my @sorted = sort sort_sub @original;
my @r_sorted = reverse @sorted;
some_sub( $_ ) for \@original, \@sorted, \@r_sorted;
print '-';
Now we use multiplicative "switch" to gain the same output:
some_sub( [ sort { $_ * sort_sub } @original ] ) for 0, 1, -1;
print '-';
Note we avoided intermediate variables.
reverse: Say we want to apply some function on original and reversed list. We can simply pass 0 or 1 into sort block:
my @reversed = reverse @original;
some_sub( $_ ) for \@original, \@reversed;
print '-';
some_sub( [ sort { $_ } @original ] ) for 0, 1;
|
|