Programming in Perl is difficult, because it is not intuitive. It is good, though. Sometimes I experience a certain relief when I find an elegant solution to an old dilema. And more often than before I put comments like
# THANK YOU, LORD!
or
# Glory to God in the Highest!
inside my code. Why? Because I'm not a perl programmer, I am a perl user, I suppose. Although I managed to write quite an extensive application in Perl, I feel like my learning of this language will never end. Unfortunately.
Don't you wish you would be able to say "I speak Perl fluently". How many of you out there can say that honestly? Does Perl have to be difficult?
How about one of my recent eurica's:
sub copy_button {
my ($item, $item_id, $parent_id) = @_;
my $kids = {
pilot => 'survey',
survey => 'section',
section => 'question',
question => 'option'
};
my $ref = $dbh->selectall_arrayref("
SELECT ID, NAME FROM $$kids{$item}s
WHERE $item\_id = $item_id
");
return submit({
name => 'copy_'.$item.'_'.$parent_id,
value => 'Copy'
})
. popup_menu({
name => 'source',
value => [ map ($$_[0], @$ref ) ],
label => { map {$$_[0], $$_[1]} @$ref } # Glory to God in the Highest!
});
}
I wish it would be simpler. Should I try Ruby?..
Fat comma (Score:3, Insightful)
Your code would be easier to read if you write
{ map {$$_[0] => $$_[1]} @$ref }
to underline the fact it builds a hash. It's a common idiom.
(On the other hand, you can write
{ map @$_, @$ref }
as well. I wouldn't recommend it.)
My learning of perl has not ended yet either. I don't think it's discouraging.
Reply to This
Natural language (Score:2, Insightful)
Re:Natural language (Score:1)
Simpler != Better (Score:2, Informative)
------------------------------
You are what you think.
Re:Simpler != Better (Score:1)
Re:Simpler != Better (Score:1)
I think it's more about what it is to you. If you want it to be a regular ol' programming language, it's certainly that. But there is a sense of community that follows the language around the battered* landscape of the Net, and the resource that the community can be is invaluable compared to the language.
I know it's frustrating at times. Just yesterday night I banged my head against regex after regex, an
------------------------------
You are what you think.
Re:Simpler != Better (Score:2)
Perl is a society, and we use a lot of analogies for that society.
If it makes you feel better, pretend the monks are Jedi adepts. Stronger in the force I feel you growing, young padawan! :)
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
Keep growing, er, going (Score:3, Interesting)
So you're saying you're a novice. That's OK. As Larry said, "You can write baby Perl and we won't laugh." But you may want to learn the seven stages of a Perl programmer [frii.com] and see how soon you will become a Perl Adept. (I'm still working on it myself.)
Reply to This
Re:Keep growing, er, going (Score:1)
You'll never stop learning Perl... (Score:2)
As if that wasn't enough, Perl is constantly growing. The community, the coding standards, t
Re:You'll never stop learning Perl... (Score:1)