Home
FREE Newsletter
Perl How To
Perl Books
Perl Basics
Perl Editors
Perl Modules
Perl Database
Net Programming
Sitemap
About Me
Contact Me
Blog
 

Perl Array Functions



NEW!!!

Check my new resource:    Perl How To Tutorial eBooks



The Perl array functions are one of the most important category of the built-in Perl functions. As you know, three data types are available in the Perl language: scalars, arrays and hashes.

A scalar, which represents the fundamental type of Perl data, can be a string, a number or a reference. When you group together two or more scalars, you have a list. If you want to refer a list throughout a Perl script, you need an array variable, represented in Perl by an identifier preceded by the @ symbol. If some of the elements of an array are references to other arrays or structures, we say that we have a multidimensional array.

The Perl language supplies a lot of functions to manipulate arrays. Every time you call a Perl array function, you must distinguish between a simple array and a multidimensional one. For instance, if you have an array which has as elements references to other arrays or hashes and if you want to delete all its elements, you need to step down through all its sub-arrays and delete their elements too.

Follow the below links to see how to use the Perl array functions.

popremoves and returns the last element of an array; the size of the array decreases by 1
pushappends the elements of a list to an array; the size of the array increases by the size of the list
shiftremoves and returns the first element of an array, reducing the number of the array elements by one
spliceremoves a subarray from an array and eventually replaces it with another array
unshiftinserts a value or a list of values at the beginning of an array and returns the new total number of the array’s elements



Subscribe now to my FREE newsletter
(regarding tips and tricks to manipulate multidimensional
arrays and hashes in Perl)

and you'll receive a link to download for FREE my Perl chomp Function Tutorial eBook, it's a bonus for you and I hope you'll enjoy it. You can see its Table of Contents here (if you subscribe to my free newsletter, you don't have to pay for this eBook or use your paypal account).


Check my new How To Tutorial eBooks (PDF format):

to see a lot of fully commented examples that help you use the Perl statements and the Perl built-in functions in your scripts.






NEW!!!

Do you want more information about the basic Perl topics?

Check my new "Perl How To" Tutorial eBooks page where I'll answer the most frequent questions regarding some topics :


Perl How To Tutorial eBooks


Table of Contents:

A Perl Script
Install Perl
Running Perl
Perl Data Types
Perl Variables
Perl Operators
Perl Lists
Perl Arrays
    Array Size
    Array Length
Perl Hashes
Perl Statements
    Perl if
    Perl unless
    Perl switch
    Perl while
    Perl do-while
    Perl until
    Perl do-until
    Perl for
    Perl foreach
Built-in Perl Functions
    Functions by Category
        String Functions
        List Functions
        Array Functions
        Hash Functions
        Miscellaneous Functions
    Functions in alphabetical order
        chomp
        chop
        chr
        crypt
        defined
        delete
        each
        grep
        hex
        index
        join
        lc
        lcfirst
        length
        map
        oct
        ord
        pack
        pop
        push
        q
        qq
        qw
        reverse
        rindex
        scalar
        shift
        sort
        splice
        split
        sprintf
        substr
        tr
        uc
        ucfirst
        undef
        unshift

return from Perl Array Functions to Perl Basics



Would you like to create your own website like this one?
Hit the Alarm Clock!

Site Build It!


footer for perl array functions page