in reply to strange responses to inhouse perl training
+= and all the C derived syntax ought be bread and butter to C/C++ folk. Regexen, map, grep, for, if as a statement modifier and hashes are where the power and succinctness of Perl are.
I showed a workmate (who has some Perl knowledge) some code that looked like:
my $token = 'do_' . lc NextWord (\$line); die "Internal parsing error. $token is not recognised\n" if ! $self->can ($token); return $self->$token ($line);
that allows me to add code like:
sub do_hi { return "Hello World"; }
and he was blown away. Showing the same code to a C++ only workmate evoked the response "Oh, that's just dynamic dispatch" (which I'd already said). The moral is, they will either get it or they won't. When they get it, a whole new world opens up. If they don't, t'aint nothin you can do.
You have a better chance showing things Perl is good at, string processing in particular (where other languages are clunky) to inspire interest.
Don't sweat syntactic details, those can be worked out when you've captured their imagination. Go for the bigger picture with a few examples of where Perl shines. Remember: regexen and hashes first, list processing (for, grep, map) second, then syntactic sugar (statement modifiers and string interpolation).
|
|---|