iLTC Home
Bookmark iLTC!
iLTC Google Boards

Google Groups
Receive The Code in Email!



Categories

Perl
  • Perl Tutorials Beginners

    Javascript
  • Javascript Tutorials
  • Javascript Tutorials Beginners

    HTML
  • HTML Tutorials



  • I love the code... dot com
    123,767

    iLoveTheCode.com
    Perl > Perl Tutorials How To Easy > Splitting an ARRAY in Perl

    Splitting an ARRAY in Perl



    Your information is in a variable you named $jiji

    $jiji="London||Paris||Tokyo||";

    You decide to name your ARRAY koko

    @koko=split(/\|\|/, $jiji);

    @koko now contains London Paris and Tokyo without the vertical bars.

    You can access them with the following variables:
    $koko[0] now equals London
    $koko[1] now equals Paris
    $koko[2] now equals Tokyo


    print "$koko[0]";

    Will print:
    London


    Another example:

    The information you need is in a variable named $huhu

    $huhu="London-Paris-Tokyo-";

    You decide to name your ARRAY gy because it's easy to type smile

    @gy=split(/-/, $huhu);

    @gy now contains London Paris and Tokyo without the dashes.

    You can access them with the following variables:
    $gy[0] now equals London
    $gy[1] now equals Paris
    $gy[2] now equals Tokyo


    print "$gy[1]";

    Will print:
    Paris


    Copy and Paste Perl Script:

    #!/usr/bin/perl

    print "Content-type:text/html\n\n";

    $huhu="London-Paris-Tokyo-";

    @gy=split(/-/, $huhu);

    print "$gy[1]";

    exit;


    Click HERE to comment or discuss at iLoveTheCode GOOGLE Group
    Previous Article:
    Next Article: Write a FOREACH LOOP in Perl





    CSSCSS

    Eric Meyer

    New $29.69

    JavaScriptJavaScript

    David Flanagan

    New $31.49

    Information Architecture...Information Architecture for the Wor...

    Louis Rosenfeld, P...

    New $26.39

    CSSCSS

    David McFarland

    New $23.09

    Bulletproof Web DesignBulletproof Web Design

    Dan Cederholm

    New $23.99

    New Perspectives on Crea...New Perspectives on Creating Web Pag...

    Patrick Carey

    New $69.26

    Dreamweaver CS3Dreamweaver CS3

    David McFarland

    New $29.69

    HTML, XHTML, and CSS, Si...HTML, XHTML, and CSS, Sixth Edition ...

    Elizabeth Castro

    New $23.09

    CSS MasteryCSS Mastery

    Andy Budd, Simon C...

    New $23.85


    Of Interest:
  • Renaming a File with Perl's RENAME Function
  • Write a FOR LOOP in Perl
  • Undefine an Array in Perl
  • Get the Length of a Word or String in Perl
  • Use onLoad to Call More than One Function with Javascript
  • Use onLoad in Body Tag with Javascript
  • Javascript Bold Text
  • Increment a Variable in Javascript
  • HTML Center
  • HTML Background
  • HTML Link
  • HTML Status

  • More Articles:
  • Add, Subtract, Multiply, and Divide in Perl
  • To Reverse an Array in Perl
  • Combine, Put Two Arrays Together in Perl
  • Create a Subroutine in Perl
  • onClick Javascript
  • If, Else If, and Else in Javascript
  • Increment a Variable in Javascript
  • Annoy Users with onBlur in Javascript
  • Write a For Loop in Javascript
  • HTML Image
  • HTML Forms
  • Make a Line Return Using HTML
  • HTML Color Codes

  • Search iLTC w/ Google





    Recent Articles

  • Javascript Focus Form Field
  • Javascript Lowercase Text
  • Javascript Uppercase Text
  • Javascript Superscript Text
  • Javascript Subscript Text
  • Make Text Blink Using Javascript
  • Make a String into a Link in Javascript
  • Javascript Italics Text
  • Javascript Bold Text
  • Javascript Redirect
  • HTML Frames
  • HTML Color Chart
  • HTML Link
  • Javascript Status Bar








  • Perl Programming - Javascript Programming - Maybe Some PHP - Free Scripts - ILoveTheCode
    All Content © 2006 iLoveTheCode.com


    Contact Chris | About this Site


    420,528
    Counter by iLoveTheCode.com


    Last Modified: Friday, 23-Jun-2006 07:23:17 EDT