Questions about this topic? Sign up to ask in the talk tab.
Perl/Basics/Variables and Data Types/Helper Functions/Split
From NetSec
Revision as of 03:16, 16 July 2012 by AlizaLorenzo (Talk | contribs) (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,...")
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> |