Questions about this topic? Sign up to ask in the talk tab.

Difference between revisions of "Perl/Basics/Variables and Data Types/Helper Functions/Split"

From NetSec
Jump to: navigation, search
(Created page with "Split takes a scalar and converts it to an array using a delimiter. Using our string from earlier: {{code|text=<syntaxhighlight lang="perl">my $joined_message = "Hello world!\n,...")
 
 
(No difference)

Latest revision as of 01:16, 19 July 2012

Split takes a scalar and converts it to an array using a delimiter. Using our string from earlier:

<syntaxhighlight lang="perl">my $joined_message = "Hello world!\n, I like perl!\n"; my @messages = split('/, /',$joined_message); print $messages[0]; print $messages[1]; print "Size of messages array: ". $#messages . "\n";</syntaxhighlight>