harshmane has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.
  • Comment on DIVIDING STRING IN TO WORD W/O USING SPLIT FUNCTION

Replies are listed 'Best First'.
Re: DIVIDING STRING IN TO WORD W/O USING SPLIT FUNCTION
by dHarry (Abbot) on Jun 27, 2011 at 11:30 UTC

    You can use substr and index for that. But why are you allergic to split?

    please add <code> tags your post is unreadable.

    Cheers

    Harry

Re: DIVIDING STRING IN TO WORD W/O USING SPLIT FUNCTION
by ambrus (Abbot) on Jun 27, 2011 at 12:41 UTC
Re: DIVIDING STRING IN TO WORD W/O USING SPLIT FUNCTION
by graff (Chancellor) on Jun 28, 2011 at 06:14 UTC
    i want to diide given string in to words w/o using split function but by using ... regexp.

    Um... split uses a regexp. Are you saying you want to write a new function that works just like split, but has a different name? How about:

    sub sprit { return ( $_[1] =~ /(.*?)(?:$_[0]|$)/g ); }
    That's not exactly the same as "split", but it's pretty close. Anyway, it's not clear what your real goal is. I think that something like your second "example" could be done using split this way:
    my @pieces = split /(\s+)/, "hello, yes, I can see you need help."; print join( ":\n :", "split returned the following pieces", @pieces ), + ":\n";