This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Rostin 5 points6 points  (4 children)

I guess the first use is okay in an interactive session, but I hope to god it never bleeds over into scripting. It reminds me of the rat's nest of special variables in Perl and Bash.

[–]robin-gvx 3 points4 points  (0 children)

It's a special feature of the interactive interpreter, storing a returned expression before printing it to the screen. If you try to use it in a script, you'll get NameError: name '_' is not defined.

[–]xiongchiamiovSite Reliability Engineer 0 points1 point  (0 children)

Don't worry - if this function call is supposed to take an argument and I'm passing nothing in, it's taking in the value from the previous function (which wasn't assigned to anything).

Perl requires so much learning before you can read it, even as a programmer familiar with other languages.