in reply to Re: split function gives emply line as output of the array element
in thread split function gives emply line as output of the array element

If there is no leading empty space (field), in his case shouldn't split return just two elements in the array?
  • Comment on Re^2: split function gives emply line as output of the array element

Replies are listed 'Best First'.
Re^3: split function gives emply line as output of the array element
by Anonymous Monk on Nov 09, 2009 at 07:50 UTC
    split CUTS your string into fields. Between the beginning of string and "WINGFRAME ", there is the empty string. Example
    $ perl -e " print qq!($_)\n! for split /,/, q!,1,2,3!" () (1) (2) (3) $ perl -e " print qq!($_)\n! for split /,/, q!,,,,1,2,3!" () () () () (1) (2) (3) $ perl -e " print qq!($_)\n! for split /(,)/, q!,,,,1,2,3!" () (,) () (,) () (,) () (,) (1) (,) (2) (,) (3)
    There is an empty string around every corner
    $ perl -e " print qq!($_)\n! for split /,/, q!5,,,!" (5) $ perl -e " print qq!($_)\n! for split /(,)/, q!5,,,!" (5) (,) () (,) () (,)