in reply to Re: split with a delimiter, every 4 time it occurs.
in thread split with a delimiter, every 4 time it occurs.

Yes,

Actually I tried the same solution by modifying it but it is not working! I am not good in Perl. Can you pls suggest me a way out.

Here is my code,

my $to_split = 'A','B','C','D','E','F','G','H','I','J','K','L','M','N' +,'O','P','Q','R','S','T','U','V','W','X','Y','Z'; my @ra = split m{ (?: \',\' [^\',\']+){50} \K \',\' }xms, $to_split ; + foreach my $piece(@ra){ print "\n\n" . $piece . "\n\n"; }

Can you pls suggest me where I got wrong?

Thanks in advance.

Replies are listed 'Best First'.
Re^3: split with a delimiter, every 4 time it occurs.
by ww (Archbishop) on Jul 01, 2013 at 14:12 UTC
    "I am not good in Perl.

    None of us were, when we first studied (formally or otherwise) how to write in Perl. So what have you done to "suggest (yourself) where (you) got wrong."

    And, again re "not good in Perl," presumably, that's why this homework was assigned... to give you a problem you can solve by applying what you've learned previously, and with judicious study of the relevant documents.

    If you didn't program your executable by toggling in binary, it wasn't really programming!