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 01:16, 19 July 2012 by Chantal21I (Talk | contribs) (moved Perl/Basics/Helper Functions/Split to Perl/Basics/Variables and Data Types/Helper Functions/Split)
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> |