Hacker News new | ask | show | jobs
by mercurial 4039 days ago
In the interest of fairness, and in regards to the "Underscore, a friend indeed", I'll point to the existence of eg, $_ and @_ as built-in Perl magic variables (you can get away with not using $_, but not @_). I have also been know to use _ for a variable I will not use later (eg, if a function returns two values but I'm only interested in one).

Additionally, in languages with pattern matching, '_' usually works like '*' and matches everything.

1 comments

It's been a while since I did much perl, but FWIW I seem to recall doing (undef, my $foo) = do_stuff(). Perhaps modern perls have tightened up allowing undef as the target of an assignment.
Ah, I don't really use $_ for discarding variables, precisely because it is a magic variable.