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) > lecture notes

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 )

[ use while/until and if/unless to draw attention to positive/negative conditions ]
1.2.2.1 Effective use of map, sort and grep in Perl

lecture notes

1 | Perl's sort, map and grep | 1.2.2.1.1

These three operators form the backbone of data analysis in Perl. Learn how to use them effectively, see typical idioms, and see how to avoid common pitfalls.

1.2.2.1.1.c1 | data.txt | Martin Krzywinski | code
1.2.2.1.1.c2 | map | Martin Krzywinski | code
1.2.2.1.1.a1 | Perl's sort, map and grep | Martin Krzywinski | pdf
1.2.2.1.1.p1 | Perl's sort, map and grep | Martin Krzywinski | ppt
1.2.2.1.1.s1 | Perl's sort, map and grep | Martin Krzywinski | slides

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