$line = "Bart Lisa Maggie Marge Homer"; @simpsons = split ( /\s/, $line ); # Splits line and uses single whitespaces # as the delimiter. #### @simpsons = split ( /\s+/, $line ); #Now splits on one-or-more whitespaces. #### $string = "Just humilityanother humilityPerl humilityhacker."; @japh = split ( /humility/, $string ); #### $string = "alpha-bravo-charlie-delta-echo-foxtrot"; @list = split ( /(-)/, $string ); #### $string = "Monk"; @letters = split ( //, $string ); #### @mydata = ( "Simpson:Homer:1-800-000-0000:40:M", "Simpson:Marge:1-800-111-1111:38:F", "Simpson:Bart:1-800-222-2222:11:M", "Simpson:Lisa:1-800-333-3333:9:F", "Simpson:Maggie:1-800-444-4444:2:F" ); foreach ( @mydata ) { ( $last, $first, $phone, $age ) = split ( /:/ ); print "You may call $age year old $first $last at $phone.\n"; } #### ( $last, $first, $everything_else) = split ( /:/, $_, 3 ); #### $string = "Hello world!"; @letters = split ( /\s*/, $string ); #### my @list = split /\s+/, $string; my @list = $string =~ /(\S+)/g; #### my @bignumbers = $string =~ /(\d{4,})/g; #### $string = join ( ':', $last, $first, $phone, $age, $sex ); #### $string = join ( ':', @array ); #### $string = join ( '', @array ); #### $string = join ( '*', "My", "Name", "Is", "Dave" ); #### $string = join ( 'humility', ( qw/My name is Dave/ ) );