Perl

Home Up Guest Book General More on IT Links

 

 

 

Professional Perl Part 5 - Attribute Lists

Attributes are a largely experimental feature, still under development, and only present from Perl version 5.6 onwards, so accordingly we have left them to the end of the chapter. The use of attributes in production code is not recommended, but being aware of them is not a bad idea, since they will ultimately mature into an official part of the language.

Professional Perl Part 4 - Returning Values from Subroutines

Subroutines can return values in one of two ways, either implicitly, by reaching the end of their block, or explicitly, through the use of the return statement.

Professional Perl Part 3 - Prototypes

The subroutines we have considered so far exert no control over what arguments are passed to them; they simply try to make sense of what is passed inside the subroutine. For many subroutines this is fine, and in some cases allows us to create subroutines that can be called in a variety of different ways.

Professional Perl Part 2 - Passing Parameters

Basic Perl subroutines do not have any formal way of defining their arguments. We say 'basic' because we can optionally define a prototype that allows us to define the types of the arguments passed, if not their names inside the subroutine.

Professional Perl Part 1 - Subroutines

Subroutines are autonomous blocks of code that function like miniature programs and can be executed from anywhere within a program. Because they are autonomous, calling them more than once will also reuse them.

Beginning Perl Part 5- More Advanced Topics

We've not actually plumbed the depths of the regular expression language syntax - Perl has a habit of adding wilder and more bizarre features to it on a regular basis. All of the more off-the-wall extensions begin with a question mark in a group - this is supposed to make you stop and ask yourself: 'Do I really want to do this?'

Beginning Perl Part 4 - Working with RegExps

Now that we've matched a string, what do we do with it? Well, sometimes it's just useful to know whether a string contains a given pattern or not. However, a lot of the time we're going to be doing search-and-replace operations on text. We'll explain how to do that here. We'll also cover some of the more advanced areas of dealing with regular expressions.

Beginning Perl Part 3 - Repetition

We've now moved from matching a specific character to a more general type of character - when we don't know (or don't care) exactly what the character will be. Now we're going to see what happens when we want to talk about a more general quantity of characters: more than three digits in a row; two to four capital letters, and so on.

Beginning Perl Part 2 - Escaping Special Characters

Of course, regular expressions can be more than just words and spaces. The rest of this chapter is going to be about the various ways we can specify more advanced matches - where portions of the match are allowed to be one of a number of characters, or where the match must occur at a certain position in the string. To do this, we'll be describing the special meanings given to certain characters - called metacharacters - and look at what these meanings are and what sort of things we can express with them.

Beginning Perl Part 1 - Regular Expressions; What are they? Interpolation

Regular expressions allow us look for patterns in our data. We can use that one single value (or pattern) to describe what we're looking for in more general terms: we can check that every sentence in a file begins with a capital letter and ends with a full stop, find out how many times James Bond's name is mentioned in 'Goldfinger', or learn if there are any repeated sequences of numbers in the decimal representation of p greater than five in length.

 

 

Hosted by www.Geocities.ws

1