Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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 about the Monastery: (10)
As of 2014-08-20 13:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (113 votes), past polls