Tracks
/
Perl
Perl
/
Exercises
/
Language List
Language List

Language List

Learning Exercise

Instructions

You're going to write some code to manage a list of programming languages to learn. The list will be contained in an array called @LanguageList::Languages.

1. Add a language to the @Languages array

Modify the LanguageList::add_language subroutine, which takes a language name as an argument, to add the language to the end of the @LanguageList::Languages array.

2. Remove a language from the @Languages array

Modify the LanguageList::remove_language subroutine to remove the last language from the @LanguageList::Languages array.

3. Fetch the first language from the @Languages array

Modify the LanguageList::first_language subroutine to return the first language in the @LanguageList::Languages array.

4. Fetch the last language from the @Languages array

Modify the LanguageList::last_language subroutine to return the last language in the @LanguageList::Languages array.

5. Fetch a slice of languages from the @Languages array

Modify the LanguageList::get_languages subroutine, which takes a list of numbers for wanted elements, to return a slice of the @LanguageList::Languages array.

6. Check if a language exists in the @Languages array

Modify the LanguageList::has_language subroutine, which takes a language name as an argument, to return either a true or false value indicating if the language exists in the @LanguageList::Languages array.

Edit via GitHub The link opens in a new window or tab
Perl Exercism

Ready to start Language List?

Sign up to Exercism to learn and master Perl with 5 concepts, 83 exercises, and real human mentoring, all for free.