Try like this:
#!usr/bin/perl -w use strict; use CGI; my $res = "aaaaubbbbuooooo"; my @rest = split /u/,$res; my $restLength = @rest; print "Content-type: text/html\n\n"; print "restLength : $restLength\n"; for (my $i=0;$i< @rest;$i++){ print "@rest[$i]\n"; } __END__ restLength : 3 aaaa bbbb ooooo
length doesn't do what you want. You need scalar @array to get the size of an array.
In reply to Re: Basic question about split
by Anonymous Monk
in thread basic question on split
by Vince75
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |