Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > cd14cddf3b3ceaf1193157472227757a > files > 894

parrot-doc-1.6.0-1mdv2010.0.i586.rpm

# Copyright (C) 2007-2009, Parrot Foundation.
# $Id: 31_array_ops_split.pir 38369 2009-04-26 12:57:09Z fperrad $

=head1

C<split> is an operation that breaks up a string at certain marker
characters, and puts the resulting parts into an array. The first
argument to C<split> is the pattern to search for, and the second
argument is the string to search. The result is an array PMC.

=cut

.sub main :main
    .local pmc words

    split words, " ", "the quick brown fox"
    $P1 = words[0]
    say $P1              # 'the'

    $P2 = words[2]
    say $P2              # 'brown'

.end

# Local Variables:
#   mode: pir
#   fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir: