in reply to Teaching Perl Idioms
As for getting them to think in Perl, force them into text-manipulation. That's where Perl started and that's where it shines. Ask them to find all the occurrences of a regex-match in a file. Have them do it in their favorite language, then in Perl. Show them 3-4 different ways in Perl, starting with the most C-like, then moving slowly to Perlisms. Try and remember how you discovered things like:
How you discovered the idioms is how you want them to discover them ... through iterative runs of the same solution, but written more and more Perlish.LINE: while (<INFILE>) { next LINE while /Foo/ .. /Bar/; chomp; # Do stuff here. }
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Teaching Perl Idioms
by Masem (Monsignor) on Sep 26, 2001 at 21:22 UTC | |
by dragonchild (Archbishop) on Sep 26, 2001 at 21:40 UTC | |
by Masem (Monsignor) on Sep 26, 2001 at 21:56 UTC |