Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Array question

by runrig (Abbot)
on Jun 14, 2008 at 03:28 UTC ( [id://692047]=note: print w/replies, xml ) Need Help??


in reply to Array question

You don't need to define the number of elements, just create the array (empty or with the elements you want) and/or push items into it until you are done.
my $file1 = "foo.txt"; my $file2 = "bar.txt"; my @array1 = ($file1, $file2); # or my @array2; print "Enter a file: "; while (<>) { chomp; push @array2, $_; print "Enter a file: "; }
Does that help?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-19 18:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found