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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Perl provides many built-ins that implement algorithms that one might otherwise be tempted to write themselves. But nowadays, so do C++, Python, Ruby, and others.

There is nothing about Perl that would prevent someone from writing just about any general purpose algorithm. It may not be the best choice for every problem domain, but there is no reason why it cannot be a good playground for implementing and learning about algorithms. Someone already mentioned the book, Mastering Algorithms with Perl. While the book is quite old, it is still an excellent source.

I have a co-worker who recently implemented a compiler in Perl, complete with a lexer, parser, stack, heap, and a virtual cpu and runtime. It's not going to win any speed contests, but nothing about Perl prevented it from being a successful project for its intended purpose.

However, when learning algorithms using any high level language, it's important to avoid the pitfall of Schlemiel the Painter. It is easy to learn the basics of a language like Perl or Python, yet miss the significance of what's going on under the hood. But again, just because the common use of a language such as Perl is to consume the high level tools of the language, those tools do not prevent you from learning algorithms. As an example, Perl has sort built in. But you could still write your own Merge Sort in Perl. There is seldom a need to write a Linked List in Perl, but Mastering Algorithms with Perl will walk you through it.

Perl isn't the sort of language you would use to write a device driver, or a kernel. But it's just fine for learning algorithms, in my opinion.


Dave


In reply to Re: Learning Algorithms using Perl. by davido
in thread Learning Algorithms using Perl. by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-26 03:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found