split

Splits a string into pieces:

@lines = split /^/m, $file_contents; 
@words = split ' ', $line;
@characters = split ”, $line;

Here is another example:

 
#!/usr/bin/perl -w 
use strict; 

my $buffer = "a   b  \012\012 \015   c "; 

$buffer =~ s/\015|\012//g;  
print $buffer . "\n";             
my @arr = split / +/, $buffer; 

foreach my $elm ( @arr)
{
    print "<$elm>\n"; 
}

The output is:

a   b      c 
<a>
<b>
<c>