Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Generate the perl sequence 1, 11, 111, ....

by JavaFan (Canon)
on Oct 10, 2008 at 19:48 UTC ( #716510=note: print w/ replies, xml ) Need Help??


in reply to Generate the perl sequence 1, 11, 111, ....

Such a home work assignment should immediately trigger the term 'recursion'. The best way to impress your teacher is:

perl -E'sub _{push@_,say@_;&_}_'
It even starts with 0 1's, for extra credits.

If you want to golf, you might want to try

perl -E'{$_.=say;redo}'


Comment on Re: Generate the perl sequence 1, 11, 111, ....
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2014-12-29 13:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (188 votes), past polls