in reply to Regex : Return match elements

I may be missing something, but this seems to be all about appropriately transforming in-place the  & | characters (and any surrounding whitespace). Nothing needs to be extracted.

Script:

use warnings; use strict; print qq{running under Perl version: $] \n\n}; my $str = <<EO_STR; must-column08:Submit & must-column10:Delivered must-column08:Submit & must-column10:Delivered One & must-column9:No_e +rror must-column08:See Here & must-column10:Delivered | must-column9:No_err +or EO_STR print qq{<<$str>>}; print qq{\n\n}; $str =~ s{ \s* ([&|]) \s* }{\n$1\n}xmsg; print qq{[[$str]]};

Output:

c:\@Work\Perl\monks\ravi45722>perl xform_str_1.pl running under Perl version: 5.008009 <<must-column08:Submit & must-column10:Delivered must-column08:Submit & must-column10:Delivered One & must-column9:No_e +rror must-column08:See Here & must-column10:Delivered | must-column9:No_err +or >> [[must-column08:Submit & must-column10:Delivered must-column08:Submit & must-column10:Delivered One & must-column9:No_error must-column08:See Here & must-column10:Delivered | must-column9:No_error ]]


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^2: Regex : Return match elements
by ravi45722 (Pilgrim) on Oct 25, 2016 at 10:15 UTC
    I need the output as a array but its returning as A string.

      I assume from this that you have a solution and need no further advice.


      Give a man a fish:  <%-{-{-{-<