[TT #819] Add tests for exsec and hav opcodes
[parrot.git] / examples / tutorial / 31_array_ops_split.pir
blob3e64b149177b9ef6c62a55fd7d8874a13c60c92e
1 # Copyright (C) 2007-2009, Parrot Foundation.
2 # $Id$
4 =head1
6 C<split> is an operation that breaks up a string at certain marker
7 characters, and puts the resulting parts into an array. The first
8 argument to C<split> is the pattern to search for, and the second
9 argument is the string to search. The result is an array PMC.
11 =cut
13 .sub main :main
14     .local pmc words
16     split words, " ", "the quick brown fox"
17     $P1 = words[0]
18     say $P1              # 'the'
20     $P2 = words[2]
21     say $P2              # 'brown'
23 .end
25 # Local Variables:
26 #   mode: pir
27 #   fill-column: 100
28 # End:
29 # vim: expandtab shiftwidth=4 ft=pir: