For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > November 2005 > the range operator









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author the range operator
orbproductions

2005-11-28, 7:40 pm

hi i am curently learning how to use perl. i am using the book perl 5 by example. it is really good, but it doesn't have some solutions. i am stuck on this question, if anyone could help me out.

this is what i have so far.

* Using the range operator (..) create an array with the following elements: 1, 5, 6, 7, 10, 11, 12.

@smallArrayOne = (1..1);
@smallArrayTwo = (5..7);
@smallArrayThree = (10..12);
@largeArray = (@smallArrayOne, @smallArrayTwo, @smallArrayThree);
print @largeArray;


-- thats what i got, i am pretty sure it's right, but the next bit confuses me a little.


* Using the array created in the last exercise, create a print command to display the last element.

i just changed print @largeArray; TO print @smallArrayThree;

this prints 10 11 12, i am not sure if this is what i am supposed to do, cause i am thinking that the question wants me to only print the last element which is 12.

thanks in advance
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com