Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Perl Puzzles

by snape (Pilgrim)
on Oct 10, 2010 at 05:26 UTC ( #864450=perlquestion: print w/ replies, xml ) Need Help??
snape has asked for the wisdom of the Perl Monks concerning the following question:

Does any one knows a book or a website of Perl puzzles? Also, I know one can increase the knowledge in a programming language - by using the "doing it" approach. What are the other means by which I can improve it. Any suggestions and advice would be highly appreciated.

Thanks.

Comment on Perl Puzzles
Re: Perl Puzzles
by kcott (Abbot) on Oct 10, 2010 at 07:22 UTC

    Well, this site (i.e. PerlMonks) is full of Perl puzzles. There's new troubleshooting puzzles in Seekers of Perl Wisdom every day. For really advanced puzzles, try determining how any code posted to Obfuscation works.

    Nearly every Perl book I've ever read has had multiple instances of: "XXX is left as an exercise to the reader". While I'm happy to be corrected, I suspect O'Reilly has the largest collection of Perl books. I wasn't intending to post any particular title but, when checking the URL for O'Reilly, I did notice Games, Diversions & Perl Culture which is possibly the type of thing you're looking for. A general Internet search may be better but be prepared for a large result set unless you're specific: googling just 'perl book' indicated over 6 million results.

    -- Ken

Re: Perl Puzzles
by eyepopslikeamosquito (Canon) on Oct 10, 2010 at 07:49 UTC

    If you like trivia nights, you might enjoy trying to solve some of the questions in Running a Perl Quiz Night -- see especially Set 3: Perl Coding and the Perl Table Questions at the end. These questions are aimed primarily at reasonably experienced Perl programmers, rather than beginners.

Re: Perl Puzzles
by GrandFather (Cardinal) on Oct 10, 2010 at 08:25 UTC

    For some, not "Perl Puzzles" exactly, but puzzles you can use perl to solve see http://projecteuler.net.

    True laziness is hard work

        That reminds me of a Rosetta code problem I did a few years ago at Perl Monks.

        Write a Perl function to reverse a string of words. For example, given an input string of:
        " one two three four "
        the function should produce:
        "four three two one"
        That is, the input string reversed word by word, with a single space between each word and with no leading or trailing space. You may assume the input string consists only of alphabetic characters, spaces and tabs.

        When you've written your function, you can view many solutions to this problem in Perl and other languages at Five Ways to Reverse a String of Words (C#, Perl 5, Perl 6, Ruby, Haskell).

        Update: Two more.

        Given an input string, for example "ZBBBCZZ", produce a list, for example, ["Z", "BBB", "C", "ZZ"]. That is, break the input string into pieces based on change of character. Solutions at Yet Another Rosetta Code Problem (Perl, Ruby, Python, Haskell, ...).

        Given a list of strings, for example ("a", "bb", "c", "d", "e", "f", "g", "h"), and a chunksize, for example 3, write a subroutine to return a multi-line string, for example:

        a bb c d e f g h
        The output string must contain a single space between each array element and a newline every chunksize items. Note that no trailing space is permitted on any line and the last line must be properly newline-terminated. Solutions at Rosetta code: Split an array into chunks.

Re: Perl Puzzles
by eyepopslikeamosquito (Canon) on Oct 10, 2010 at 09:23 UTC
Re: Perl Puzzles
by ambrus (Abbot) on Oct 10, 2010 at 10:17 UTC
Re: Perl Puzzles
by Limbic~Region (Chancellor) on Oct 10, 2010 at 17:16 UTC
Re: Perl Puzzles
by uwevoelker (Pilgrim) on Oct 11, 2010 at 07:51 UTC
    I suggest codegolf.com. It has small tasks, a good description and it even tests your solution. Its intent is code golfing (writing the shortest possible solution), but you can also submit long solutions.

      Thanks a lot everyone for their views.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://864450]
Front-paged by tye
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2014-09-20 07:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (157 votes), past polls