Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Clear questions and runnable code
get the best and fastest answer

Re: Out gunned - and crashing

by muba (Priest)
on Jan 28, 2013 at 17:44 UTC ( #1015743=note: print w/ replies, xml ) Need Help??

in reply to Out gunned - and crashing

Lean back in your chair. Breathe. For a moment, just sit there and breathe.

From reading your post, I get the impression that you want too much, too quick. So sit back, relax, and hear me out.

Since Perl 1, back in the eighties, Perl has come a long way. It's a general purpose programming language, that strives to make easy things easy and hard things possible. Unfortunately, that comes at a price. To make easy things easy, Perl has to be a lot of things. That can be imitating.

For example, is Perl an OO programming language? Yes and no: Perl has built-in support for OO, and modules like Moose (edit: fixed linkage) extend Perl's OO system even further, but it's not an OO language in the sense that everything is an object.

Is Perl a functional programming language? Yes and no: functions such as grep, map, and sort take another function as an argument, and you can even write your own subroutines that do that, but functions aren't really first-class citizens. You can pretend they are by using references, if you want, though. This might sound like black magic right now, but given enough time, you'll find that you're throwing around references in your code like you've never done anything else.

Keep breathing. Everything's all right.

Then, is Perl an event-driven language? Well, it's not that hard to write an event-driven script, but strictly speaking Perl is not an event-driven language, although there are event-driven frameworks out there.

So is Perl at heart an imperative language, then? Well, yes, if you want it to be.

In short, Perl offers you, the programmer, a lot of ways to solve a lot of problems. Whichever way you pick entirely depends on what seems most natural for the problem at hand. But Perl tries to be in your way as little as possible, just handing you a bunch of tools that you can use as you see fit.

For example, there are no stacks or queues in Perl, but there are arrays, and there are functions such as pop, push, shift, and unshift. An array + push + pop is just like a stack, ad a array + push + shift perfectly mimics a queue. Minimalist tools that at the same time provide a great deal of flexibility.

If you want to learn Perl, you'll have to learn about the tools that Perl gives you. Once you have a solid grasp on those, you'll be able to combine them into something that does what you want. So pick up a good book, work your way through Getting Started with Perl (as suggested per blue_cowdawg), play with the examples and see how your changes affect the way the program runs, make mistakes and learn from them, and of course ask questions here if there's something you don't understand or if there's something you need to know.

But take your time. Don't try to get it all at once. It took about two decades for Perl to get where it is now, nobody expects you to pick it up overnight.

Once you get a basic understanding of the toolset that Perl is, you'll be able to make those tools work for you. And you don't even have to know all there is to know: Perl is friendly enough that it lets you write working programs even while you're just a novice Perl hacker, and you will find that the language grows with you as you grow into the language. You just sit back, keep breathing calmly, and give Perl a chance.

Comment on Re: Out gunned - and crashing
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1015743]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2014-04-19 18:07 GMT
Find Nodes?
    Voting Booth?

    April first is:

    Results (483 votes), past polls