1. This is the list we just initialized:
one:two:thee:
Using replicator:
1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:
This one was initialized using push:
new_one:new_two:new_thee:
Tiny parser to split this file into words. We'll print first 20:
(#!/usr/bin/perl) (#%%) (Working) (with) (lists) ((arrays)) (|) (GEN) (|) (--) (#_______________________________________) (print) ("content-type:) (text/html\n\n";) (#) (1.) (Initializing/adding) (elements) (to) (list)
list of two lists:
(if:you:can:keep:)(your:head:when:all:about:you:)
2. First and last elements of @new
new_one:new_thee
3. Change last index value to grow or shrink the list:
Grown list of 6 elements: new_one:new_two:new_thee::::
Shrunk list of 2 elements: new_one:new_two:
4. Create reference to a list:
AAA:AAA:AAA:AAA:AAA:
5. Extracting unique elements from the list using hash:
original @list :5:5:5:WWW:WWW:10:10:10:10:
@uniq list : WWW:10:5:
Another way to do it:
@uni list : 5:WWW:10:
6. Add @arr1 to the end of @arr :
1:2:3:4:5:6:
or just join them with (@arr,@arr1) :
1:2:3:4:5:6:4:5:6:
7. Insert (7,7) after 6 in @ll :
1:6:7:7:3:4:5:
Replace (7,7) with (9,9) in @ll :
1:6:9:9:3:4:5:
8. Reversing a list :
9:8:7:6:5:4:3:2:1:
9. Sorting lists:
Numerically, ascending: 0:4:5:6:7:11:19:
Numerically, descending: 19:11:7:6:5:4:0: