![]() |
|
[TUT] Perl Basic's Using Arrays. Name Holder [Beginner LVL 4] - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Coding (https://sinister.ly/Forum-Coding--71) +--- Thread: [TUT] Perl Basic's Using Arrays. Name Holder [Beginner LVL 4] (/Thread-TUT-Perl-Basic-s-Using-Arrays-Name-Holder-Beginner-LVL-4) |
[TUT] Perl Basic's Using Arrays. Name Holder [Beginner LVL 4] - FrostByte_mybb_import5923 - 05-10-2011 Hello and welcome to another Perl tutorial. In this tutorial we will be covering the basic's of arrays. An array is similar to a Variable in the way it is declared by a symbol @, Except an array can hold multiple value's. So let's begin our basic arrays tutorial. code: Code: print"\n\n-- # p-teo arrays # --";
print"\n>>";
@names = ("james", "anna", "elis", "peter", "adam", "john", "elvis", "danny", "wayne", "javier", "sam", "harry", "ray", "chris", "ashley", "electra", "frodo");
my $input = <STDIN>;
if ($input eq "names") {
print"@names";
} else {
print"Invalid command";
}Explained. Code: print"\n\n-- # p-teo arrays # --";
print"\n>>";Code: @names = ("james", "anna", "elis", "peter", "adam", "john", "elvis", "danny", "wayne", "javier", "sam", "harry", "ray", "chris", "ashley", "electra", "frodo");Code: my $input = <STDIN>;Code: if ($input eq "names") {
print"@names";
} else {
print"Invalid command";
}Thanks for reading my tutorial, hope you found this useful, feel free to look at my other tutorials and have a nice day. |