CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Display Array Content error............

 



webhay
Novice

Jan 2, 2001, 6:32 AM

Post #1 of 2 (828 views)
Display Array Content error............ Can't Post

I want to Display Array Content Like This But Is Not Working...

For($i=10; $i<@array; $i++)
{
print Something;

}

Please Helpe; :-)



Jasmine
Administrator / Moderator

Jan 2, 2001, 8:53 AM

Post #2 of 2 (827 views)
Re: Display Array Content error............ [In reply to] Can't Post

The question is what is in @array when you run this snippet.

Basically you're saying "i is equal to 1. While i is less than then the total number of elements in @array, increment i and print something".

If you're not starting out with at least 11 elements in @array, nothing will be printed.


Code
@array = (1 .. 11); 

for($i=10; $i<@array; $i++)
{
print "$i\n";

}

The above prints out the number 10 only.


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives