# The split function allows you to split a string wherever a regular expression is matched
@ArrayOfParts = split( /,/, $Text); # Splits wherever a comma is found
@ArrayOfParts = split( /\s+/, $Text); # Splits where whitespace is found
@ArrayOfParts = split( /,\s*/, $Text); # Comma followed by optional whitespace
@ArrayOfParts = split( /\n/, $Text); # Newline marks where to split
# This function sets the variables $1, $2, $3 ...
# to the information that it has extracted from a string.
$Text =~ m/before(.*)after/;
# So, if $Text was "beforeHelloafter", $1 is now "Hello"
$Text =~ m/bef(.*)bet(.*)aft/;
# This time, if $Text was "befOnebetTwoaft", $1 is now "One" and $2 is "Two"
# It can also be used to extract certain kind of information.
$Text =~ m|([^=]*)=(\d*)|;
#If $Text was "id=889", $1 now equals "id" and $2 equals 889.