Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Filling an array

by robsv (Curate)
on Sep 06, 2001 at 19:57 UTC ( #110605=note: print w/ replies, xml ) Need Help??


in reply to Filling an array

Use the x (repetition) operator:

my @arr = (1)x100;
Don't forget the parens around the 1 - if they're not there, you'll end up with an array containing one element: 100 1s concatenated together.

- robsv


Comment on Re: Filling an array
Download Code
Re: Re: Filling an array
by zakzebrowski (Curate) on Sep 07, 2001 at 00:15 UTC
    Cool! Didn't know of the x operator....

    ----
    Zak

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2015-07-07 16:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (91 votes), past polls