[LIP] trying to learn

Ritesh Raj Sarraf <[email protected]>
Newsgroups gmane.user-groups.linux.india.programmers
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello everyone,
 	While learning perl came across this problem, someone please
 	help me understand it clear.

 	This program is a simple exercise program from one of the perl
 	books where multiple numbers separated by spaces and entered on
 	separate lines (you'll understand it easily if you read the code
 	below). The desired output is to have sum total of the number of
 	each line and a grand total of all the lines.

 	Below is my incomplete source code. I tried taking multiple
 	lines into an array and then split them. In the for loop I want
 	my new array name to be assigned at runtime like @line1, @line2
 	and so..
 	How do I do that ? Or is my procedure incorrect to get the
 	desired output ??   Please help

rrs


#!/usr/bin/perl
#
#
print "Please enter multiple numbers separated by spaces on multiple lines.\n";
print "When finished, Press CTRL + D\n";
@numbers = <STDIN>;

@all_lines = split(/\n/, @numbers);

$count = 0;
$number_of_lines = @all_lines;
@string_array = (1..9);

for(; $count <= $number_of_lines; $count++)
{
 	@line.($count + 1) = @all_lines[$count];

}
# Now we sum up each line.
#
#$line1total = 0;
#for ($count = 0; $count <=

- --
Ritesh Raj Sarraf
RESEARCHUT -- http://www.researchut.com
Gnupg Key ID: 04F130BC
"Stealing logic from one person is plagiarism, stealing from many is research".
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Made with pgp4pine 1.76

iD8DBQFBOBAQ4Rhi6gTxMLwRAvvJAJ992juVat/dkOOWOeUSir1ipKk/fwCfdSCy
22LoX/slcghlF+MzPTTTmVc=
=C/N3
-----END PGP SIGNATURE-----



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.