arrays - How can I build a 2D matrix from standard input in Perl? -
OK, I'm struggling all this weekend, and I've got a lot of help, but I still do not I'm getting this. Here's my code: What I want to do is create some matrix from user input, and eventually I want to multiply them. another story.
The input is as follows:
1 2 2 4 4 6 6 1 2 2 3 1 2 2 3 Sub Make Metrics {my ($ input) = @_ ; My @mate; While (& lt; $ input & gt;) {if ($ input eq "") {print "this is empty \ n"; Return; } And {push @mat, [partition]; } Return \ @mat; }} My @ a = (); While ($ a = <>
Why does not this work? Why can not it make an array of matrix in @matrices
? Is this a return
statement in subtitle? My goal is to place two matrix in the matrix array. Thank you for all of your help.
You think that & lt;> operator
line
while (& lt; IN input & gt;)
is incorrect. It tells Perl to read with a filehead $ input
However, the substrate in which you have passed is not a file hand, this is a piece of text you do not need & lt;> Besides, you have left most of the input substrate, you call it this way:
make matrix (@a)
but then you Use only the first value of @ A
routine in routine such Ikna must:
Comments
Post a Comment