原创 Learning Perl: 4.8. The use strict Pragma

  4.8. The use strict Pragma Perl tends to be a permissive language.[] But maybe you want Perl to impose a li

原创 Learning Perl: 7.2. Using Simple Patterns

  7.2. Using Simple Patterns To match a pattern (regular expression) against the contents of $_, put the patt

原创 Perl Learning: 7.3. Character Classes

  7.3. Character Classes A character class, a list of possible characters inside square brackets ([ ]), match

原创 Learning Perl: 4.10. Non-Scalar Return Values

  4.10. Non-Scalar Return Values A scalar isn't the only kind of return value a subroutine may have. If you c

原创 Learning Perl: 5.9. Using Filehandles

  5.9. Using Filehandles Once a filehandle is open for reading, you can read lines from it the same way you ca

原创 Learning Perl: 5.2. Input from the Diamond Operator

  5.2. Input from the Diamond Operator Another way to read input is with the diamond[*] operator: <>. This is

原创 Learning Perl: 5.5. Formatted Output with printf

  5.5. Formatted Output with printf You may wish to have a little more control with your output than print pr

原创 Learning Perl: 6.4. Typical Use of a Hash

  6.4. Typical Use of a Hash At this point, a concrete example might help. The Bedrock library uses a Perl pro

原创 Learning Perl: 5.1. Input from Standard Input

  5.1. Input from Standard Input Reading from the standard input stream is easy. We've been doing it with the

原创 Learning Perl: 5.7. Opening a Filehandle

5.7. Opening a Filehandle You've seen that Perl provides three fileha

原创 Learning Perl: 5.8. Fatal Errors with die

  5.8. Fatal Errors with die Let's step aside for a moment. We need some stuff that isn't directly related to

原创 Learning Perl: 6.1. What Is a Hash?

  6.1. What Is a Hash? A hash is a data structure like an array, in that it can hold any number of values and

原创 Learning Perl: 6.3. Hash Functions

  6.3. Hash Functions Some useful functions can work on an entire hash simultaneously. 6.3.1. The keys and v

原创 Learning Perl: 4.9. The return Operator

  4.9. The return Operator The return operator immediately returns a value from a subroutine: my @names =

原创 Learning Perl:

  6.2. Hash Element Access To access an element of a hash, use syntax that looks like this: $hash{$some_k