Learning Perl

By brian d foy, Tom Phoenix

If you are simply getting began with Perl, this is often the publication you want—whether you are a programmer, procedure administrator, or internet hacker. Nicknamed "the Llama" by way of generations of clients, this bestseller heavily follows the preferred introductory Perl direction taught via the authors due to the fact that 1991. This sixth variation covers fresh adjustments to the language as much as model 5.14.

Perl is acceptable for nearly any activity on virtually any platform, from brief fixes to accomplish internet functions. Learning Perl teaches you the fundamentals and exhibits you the way to write down courses as much as 128 strains long—roughly the scale of ninety% of the Perl courses in use this day. each one bankruptcy comprises workouts that will help you perform what you will have simply realized. different books could educate you to application in Perl, yet this publication will flip you right into a Perl programmer.

Topics include:

  • Perl info and variable types
  • Subroutines
  • File operations
  • Regular expressions
  • String manipulation (including Unicode)
  • Lists and sorting
  • Process management
  • Smart matching
  • Use of 3rd celebration modules

Show description

Preview of Learning Perl PDF

Similar Development books

Introduction to Programming Using Python plus MyProgrammingLab with Pearson eText -- Access Card

Be aware: earlier than deciding to buy, discuss with your teacher to make sure you pick out the proper ISBN. a number of types of Pearson's MyLab & studying items exist for every identify, and registrations aren't transferable. To sign up for and use Pearson's MyLab & learning items, you can even desire a path identity, which your teacher will offer.

Ground Control: Fear and Happiness in the Twenty-First-Century City

Whilst the figures say crime is falling, why are we extra fearful than ever? might our cities and towns be developing worry and distrust? extra estate is being in-built Britain than at any time because the moment international struggle - yet it is owned through inner most businesses, designed for revenue and watched over by way of CCTV.

The Dragon's Gift: The Real Story of China in Africa

Is China a rogue donor, as a few media pundits recommend? Or is China supporting the constructing international pave a pathway out of poverty, because the chinese language declare? within the previous few years, China's relief application has leapt out of the shadows. Media experiences approximately large relief applications, help for pariah regimes, regiments of chinese language hard work, and the ruthless exploitation of staff and traditional assets in the various poorest international locations on the earth sparked fierce debates.

The Coming Prosperity: How Entrepreneurs Are Transforming the Global Economy

Ours is the main dynamic period in human heritage. the advantages of 4 centuries of technological and organizational swap are finally achieving a formerly excluded worldwide majority. this variation will create large-scale possibilities in richer nations just like the usa simply because it has in poorer international locations now within the ascent.

Additional resources for Learning Perl

Show sample text content

Substitutions with s/// | 137 s/(\w+) with (\w+)/\U$2\E with $1/i; # $_ is now "I observed FRED with barney. " while written in lowercase (\l and \u ), they have an effect on simply the following personality: s/(fred|barney)/\u$1/ig; # $_ is now "I observed FRED with Barney. " you may as well stack them up. utilizing \u with \L potential “all lowercase, yet capitalize the first letter”:* s/(fred|barney)/\u\L$1/ig; # $_ is now "I observed Fred with Barney. " because it occurs, even if we’re masking case moving when it comes to substitutions, those break out sequences are available any double-quotish string: print "Hello, \L\u$name\E, do you want to play a video game? \n"; The cut up Operator one other operator that makes use of general expressions is divided, which breaks up a string ac- cording to a trend. this is often helpful for tab-separated info, or colon-separated, whitespace-separated, or anything-separated info, rather. † as long as you could specify the separator with a standard expression (and usually, it’s an easy standard expression), you should use break up. It feels like this: @fields = break up /separator/, $string; The cut up operator‡ drags the trend via a string and returns a listing of fields (sub- strings) that have been separated via the separators. at any time when the trend suits, that’s the top of 1 box and the beginning of the subsequent. So, something that fits the development will by no means appear within the lower back fields. Here’s a customary break up trend, splitting on colons: @fields = cut up /:/, "abc:def:g:h"; # supplies ("abc", "def", "g", "h") you may also have an empty box, if there have been delimiters jointly: @fields = break up /:/, "abc:def::g:h"; # provides ("abc", "def", "", "g", "h") Here’s a rule that turns out atypical firstly, however it hardly reasons difficulties: top empty fields are constantly back, yet trailing empty fields are discarded. For example:‖ @fields = cut up /:/, ":::a:b:c:::"; # offers ("", "", "", "a", "b", "c") * The \L and \u might sound jointly in both order. Larry learned that individuals may occasionally get these backward, so he made Perl work out that you really want simply the 1st letter capitalized and the remaining lowercase. Larry is a beautiful great man. † other than “comma-separated values,” generally referred to as CSV documents. these are a soreness to do with break up; you’re larger off getting the Text::CSV module from CPAN. ‡ It’s an operator, although it acts much like a functionality, and everybody normally calls it a functionality. however the technical information of the variation are past the scope of this booklet. ‖ this can be purely the default. It’s this fashion for potency. if you happen to fear approximately wasting trailing empty fields, use −1 as a 3rd argument to separate and they’ll be saved; see the perlfunc manpage. 138 | bankruptcy 9: Processing textual content with commonplace Expressions It’s additionally universal to separate on whitespace, utilizing /\s+/ because the development. lower than that trend, all whitespace runs are comparable to a unmarried house: my $some_input = "This is a \t try. \n"; my @args = break up /\s+/, $some_input; # ("This", "is", "a", "test. ") The default for cut up is to wreck up $_ on whitespace: my @fields = cut up; # like break up /\s+/, $_; this can be nearly similar to utilizing /\s+/ because the development, other than that during this certain case a best empty box is suppressed—so, if the road starts off with whitespace, you won’t see an empty box first and foremost of the record.

Download PDF sample

Rated 4.00 of 5 – based on 8 votes