in reply to Re: Seeking help with split!
in thread Seeking help with split!

Thanks AnomalousMonk.

I have another doubt now. How can we split the below with the delimiter "','" with same 4 times?

my $data = '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';

So that output will be like,

'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'

I tried your code, but not working with "','"

Replies are listed 'Best First'.
Re^3: Seeking help with split!
by Happy-the-monk (Canon) on Jul 01, 2013 at 07:45 UTC

    nah, it is your code that's not working. You assign a list to a scalar (not meant to store a list, see perlintro) and perl, trying what's possible, takes the first scalar value off that list and stores it in $data. Check that variable:

    my $data = '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'

    print $data; A

    See?
    So what was your intention? Use an array? Put quotation marks into a string? I cannot tell from your question.

    Cheers, Sören

    (hooked on the Perl Programming language)