Home >> perlfunctions >>Perl function : splitsplit [ PATTERN [ , EXPR† [ , LIMIT ] ] ]Splits a string into an array of strings, and returns it. If LIMIT is specified, splits into at most that number of fields. If PATTERN is also omitted, splits at the whitespace. If not in array context, returns number of fields and splits to @_.
#!/usr/bin/perl
use strict;
my $st="101,32,45,67";
my @spt=split(",",$st);
print $spt[0];
in above example 101 will be printed.
Perl functions
|
List of all perl functions Perl function: abs Perl function: chomp Perl function: chop Perl function: chr Perl function: crypt Perl function: eval Perl function: hex Perl function: lc Perl function: lcfirst Perl function: length Perl function: oct Perl function: ord Perl function: shift
|