The distinctive Perl camel is (c) O'Reilly
Perl Workshop Home Page
Home of the Bioinformatics Perl Workshop perl workshop > courses > effective use of map, sort and grep in perl (1.2.2.1)

course 1.2.2.1

Level: intermediate
1.2.2.1 | intermediate | 1 sessions
These three operators - map, sort and grep - pack a lot of functionality. Not uncommonly, the three can be used on a single line to extract, transform and order data. Use map to initialize, distill and transform data structures. Use sort to not only order data, but also shuffle data. Finally, grep is used to extract data using a test condition. Each of these operators lends itself to idiomatic patterns, which will be discussed. As well, each of these operators can be misused and can lead to subtle bugs in your code. I'll try to point a few of these out.

legend

course code

cat.course.level.sessions.session

e.g. 1.0.1.8

categories

0 | introduction and orientation

1 | perl fundamentals

2 | shell and prompt tools

3 | web development

4 | CPAN Modules

5 | Ruby

levels

level: all all ( 0 )

level: beginner beginner ( 1 )

level: intermediate intermediate ( 2 )

level: advanced advanced ( 3 )

[ have you wondered how many different banners there are? ]
1.2.2.1 Effective use of map, sort and grep in Perl

course home

These three operators - map, sort and grep - pack a lot of functionality. Not uncommonly, the three can be used on a single line to extract, transform and order data. Use map to initialize, distill and transform data structures. Use sort to not only order data, but also shuffle data. Finally, grep is used to extract data using a test condition. Each of these operators lends itself to idiomatic patterns, which will be discussed. As well, each of these operators can be misused and can lead to subtle bugs in your code. I'll try to point a few of these out.

other in this category

1.0.1.8 | Introduction to Perl

1.1.2.8 | Intermediate Perl

other by same level

1.1.2.8 | Intermediate Perl

2.1.2.4 | Data Mining and Analysis at the Command Line

2.2.2.2 | Prompt Tools

4.0.2.1 | Spans and Sets

4.1.2.2 | Random Numbers and Distributions

other by same instructor

Other courses by Martin Krzywinski.

0.0.0.1 | Orientation Session

0.1.0.1 | Two Problems

1.0.1.8 | Introduction to Perl

1.1.2.8 | Intermediate Perl

2.1.2.4 | Data Mining and Analysis at the Command Line

2.2.2.2 | Prompt Tools

4.0.2.1 | Spans and Sets

4.1.2.2 | Random Numbers and Distributions