perl function

The Perl exists function - test to see if a hash key exists

Perl "hash key exists" FAQ: How can I test to see if a key exists in a Perl hash?

Many times when working with a Perl hash, you need to know if a certain key already exists in the hash. The Perl exists function lets you easily determine if a key already exists in the hash.

Perl subroutines - a Perl subroutine (sub) tutorial

Perl subroutines FAQ - As a developer, when you start working with subroutines in Perl, you'll probably have the same questions I did:

  • How do I define a Perl subroutine?
  • How do I call a Perl subroutine?
  • How do I pass arguments to a Perl subroutine?
  • How do I access arguments in a Perl subroutine?
  • How do I return a value from a Perl subroutine?

Perl subroutine - how to return multiple values

Perl subroutines - multiple return values FAQ: Can you share some examples of how to return multiple values from a Perl subroutine?

Did you know that you can return multiple values from a Perl subroutine (function)? As a practical matter I haven't used this feature very much, but I've always thought it was an interesting programming language feature, very different from many other languages.

How do I make variables private to my Perl function?

Perl function FAQ: How do I make variables private to my Perl function?

Answer: Just use the Perl my operator. Here's an example that shows how to create a variable named bar that is private to the function name foo: