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 exploiting the Monastery: (12)
As of 2014-10-21 20:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (109 votes), past polls