News for hackers. Stuff that matters.
Re:Which Programming Languages Are Functional? by typon on Wednesday December 30, 2015 @10:23AM (#10812375)
Oh lord... I envy your innocence. This isn't even the whole story. There are like ten more of these (good luck remember which one does what). They are all something like $., $/, $" etc. and they're all global.
Re:Which Programming Languages Are Functional? by Mithaldu on Wednesday December 30, 2015 @10:31AM (#10812411)
They're all documented and explained in https://metacpan.org/pod/distribution/perl/pod/perlvar.pod and all have english names available and all but a small hand-full only exist for backwards compatibility at this point.
Re:Which Programming Languages Are Functional? by typon on Wednesday December 30, 2015 @10:34AM (#10812423)
I would never use them in my code. The problem is when I'm debugging 5 year old code it becomes such a headache.
Re:Which Programming Languages Are Functional? by arethuza on Wednesday December 30, 2015 @10:41AM (#10812450)
I thought that the point of $_ was that you don't reference it directly in your code?
Re:Which Programming Languages Are Functional? by Mithaldu on Wednesday December 30, 2015 @10:44AM (#10812472)
It is!

But sometimes you end up using it to make code more reliable, as in:

    do_thing($_) for @things;
Where $_ is passed in as an argument, as opposed to:

    do_thing for @things;
Where $_ is (due to its global nature) set by `for`, and read in sub do_thing { ... }
Re:Which Programming Languages Are Functional? by Mithaldu on Wednesday December 30, 2015 @10:42AM (#10812456)
> I would never use them in my code.

Most people don't. The only one that is used a lot is @_. :)

As for debugging old code, that's why i pointed out perlvar. It's never far and it's always easy to look up what a specific var does.

Re:Which Programming Languages Are Functional? by typon on Wednesday December 30, 2015 @11:03AM (#10812566)
Well I end up doing that of course, but I'm just complaining that it gets really annoying really fast seeing all these dollar signs peppered in the code, making it super unreadable.