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