5 ms·
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 some
by typon 11y ago
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.
- deleted 11y ago[deleted]
- Mithaldu 11y agoThey're all documented and explained in https://metacpan.org/pod/distribution/perl/pod/perlvar.pod 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.
- typon 11y agoI would never use them in my code. The problem is when I'm debugging 5 year old code it becomes such a headache.
- arethuza 11y agoI thought that the point of $_ was that you don't reference it directly in your code?
- Mithaldu 11y agoIt 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 { ... }
- Mithaldu 11y ago> 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.
- typon 11y agoWell 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.