Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

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

Many replies already, but I would like to offer my own view... The OP is vague about the target depth in learning algorithms. If you're just starting out and have yet to develop algorithmic thinking abilities, Perl is a fantastic choice. As other monks have pointed out, a lot of the unnecessary distraction is hidden away and not relevant to programming in Perl (like memory management and types of variables). The fundamental data structures are part of the language, so you can immediately become used to the operations they support and how these fundamentals are applied in higher-level algorithms.

By "just" writing Perl programs, you'll get an intuitive understanding of lists, arrays, stacks, queues, hash tables, multidimensional data structures and operations on them without having to first study each one separately and in detail. Once you have that understanding, it's easier and faster to learn about the formal aspects of designing these data structures and algorithms on them.

If you're looking for the deepest algorithm expertise, Perl is still an interesting starting point, but it must be one among many other programming languages you know. For example, every time I read about or program in some other programming language, whether it's Pascal, Common Lisp, Haskell, C, C++, Go, Rust, Javascript, Python, R, XSLT, MMIX assembler or even GNU makefiles, I always learn something new that I can take and apply to programs I write in Perl.

There are some things that are hard to learn if you only know Perl. Memory management is one of them, as are references and the related ability to grasp indirection. You can simulate computer memory by allocating a large array and treating array indices as pointers to memory. But why would you do that in Perl? It serves no practical purpose. On the other hand, it's really hard to design efficient algorithms in Perl without understanding how it manages memory and what its benefits and drawbacks are, and it's hard to get an intuitive understanding of Perl's memory model without managing memory by hand.

So, you learn a lower level language without automatic memory management, like C. Even if you never become a full-time C programmer, that experience will influence how you design algorithms and how you write Perl programs. This influence goes both ways, because what you really learn after mastering the basics is different ways of thinking about computations. That knowledge and algorithmic thinking is transferable, and it doesn't matter in the end what programming language you use.


In reply to Re: Learning Algorithms using Perl. by vrk
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 contemplating the Monastery: (9)
As of 2024-04-18 15:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found