in reply to basic question on split
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Basic question about split
by Vince75 (Initiate) on Dec 12, 2003 at 23:40 UTC | |
by flyingmoose (Priest) on Dec 13, 2003 at 01:21 UTC |