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
    Works :-)
    Thanks a lot.
    I still have to understand both perl and how this forum works. When I go to the index of "Seekers of Perl Wisdom" I do not see my question. I used the "search method to find it and to see your answers. In the meantime I wrote my question again. Sorry to everybody for the mess.

      That explains the similar questions :)

      The way this forum works is that certain questions posted don't appear in Seekers Of Perl Wisdom right away. They have to be "approved" by uber-monks first. It will still appear under "Newest Nodes" so there really isn't a reason to post twice.

      There is some reading info here: MonkStart