Timeline for Turn an integer n into a list containing it n times
Current License: CC BY-SA 3.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 23, 2017 at 22:54 | comment | added | aschepler | @Thor I wouldn't count that as satisfying "return a list". | |
| Aug 22, 2017 at 23:49 | comment | added | Thor | I meant something like this: echo 5 | perl -pe '$_=$_ x$_' | |
| Aug 22, 2017 at 23:29 | history | edited | aschepler | CC BY-SA 3.0 | added 77 characters in body |
| Aug 22, 2017 at 23:24 | comment | added | aschepler | @Thor x does string repetition, not list repetition, unless the left operand is in parentheses (or is a qw operator) and the x is evaluated in list context. And of course $_ is a scalar, not a list. | |
| Aug 22, 2017 at 6:45 | comment | added | Thor | Why not $_=$_ x$_ with perl -pe? | |
| Aug 21, 2017 at 16:07 | comment | added | Brad Gilbert b2gills | I would say it doesn't count as a built-in because you have to work around the fact that it takes two inputs instead of one. | |
| Aug 21, 2017 at 13:10 | comment | added | Dom Hastings | Had pretty much the same, but you can change the first $_[0] to @_! Also the second can be"@_" I think... | |
| Aug 21, 2017 at 12:14 | history | answered | aschepler | CC BY-SA 3.0 |