
zebu
New User
Feb 6, 2012, 7:20 PM
Post #4 of 5
(725 views)
|
|
Re: [BillKSmith] Help with arrays and loops
[In reply to]
|
Can't Post
|
|
Bill, Thanks again. I rewrote my script although I'm having the same issue. I also included the output. I need the last line to list all integers entered into the array (in this case 67, 8) - not just the last integer. #!/usr/bin/perl $int = 1; @list = $int; foreach $int(@list) { while ($int != 0) { print ("Enter an integer: "); $int = <stdin>; chomp $int; } print ("Integers: ", @list[$int]); } OUTPUT: C:\Documents and Settings\Admin\My Documents\Downloads\PERL\comp.pl Enter an integer: 67 Enter an integer: 8 Enter an integer: 0 Integers: 0 Thank you again, Sir. BG
|