Computing.Net > Forums > Programming > The array again!!

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

The array again!!

Reply to Message Icon

Name: Danny Larouche
Date: May 1, 2002 at 07:45:28 Pacific
Comment:

is there a better way in perl to do:

($A[1], $A[2], $A[3]...) = split (/:/, $_);

Without having to list all arguments



Sponsored Link
Ads by Google

Response Number 1
Name: Tom
Date: May 1, 2002 at 20:34:27 Pacific
Reply:

@A = split (/:/, $_);


0

Response Number 2
Name: Danny Larouche
Date: May 2, 2002 at 13:42:51 Pacific
Reply:

Then if need a multidimentional array like the following program with variable such as: "$myvar[2][3]"


$i=0;
while () {
$i++;
($V[1][$i],$V[2][$i],$V[3][$i],... ) = split(/:/, $_);
}
print "VAR: $V[2][3]\n";
~~~~~~



0

Response Number 3
Name: Tom
Date: May 2, 2002 at 19:11:13 Pacific
Reply:

Not sure on this, my guess would be:

for($i = 0; $i < 5; $i++){
@V[$i] = split(/:/, $_);
}

But why would you want to do that? You would just have a few copies of an array in another array. $V[0][0] would be the same as $V[1][0], $V[2][0] etc.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: The array again!!

cannot Sort String Array in JAVA www.computing.net/answers/programming/cannot-sort-string-array-in-java-/8805.html

Array Printing Problem www.computing.net/answers/programming/array-printing-problem/7338.html

Multidimentional Arrays www.computing.net/answers/programming/multidimentional-arrays/12537.html