in reply to Perl one-liner for array at bash shell

TIMTOWTDI
perl -ple 's/[;\s]+/m#.*,#;$\.$&/eg'

Replies are listed 'Best First'.
Re^2: Perl one-liner for array at bash shell
by Anonymous Monk on Aug 22, 2017 at 21:06 UTC
    Ok this works perfectly too... what does the m# the ,# and the $& stand for here? Love perl special chars !
      m#.*,# is the same as /.*,/ but the slashes were already used by s///, and the vars are $\ (set by perl -l to "\n", see perlrun) and $&. Same thing:
      perl -ple 's{ [;\s]+ }{ m{.*,}; $/ . $& }egx' perl -ple '($a)=/(.*,)/; s/[;\s]+/\n$a/g'