in reply to Re^2: Inserting an element into an array after a certain element
in thread Inserting an element into an array after a certain element
Oh, it breaks if any of the elements consists of more than one character:
but single spaces are fine:% perl -le 'print"@{[split//,join q(x),split/(?<=c)/,join(q(),qw(a b c + d c e foo f)),2]}"' a b c x d c e f o o f
To fix this, I guess one could do something like% perl -le 'print"@{[split//,join q(x),split/(?<=c)/,join(q(),qw(a b c + d c e),q( ),q(f)),2]}"' a b c x d c e f
perl -le 'print"@{[split/\0/,join qq(\0x),split/(?<=c)/,join(qq(0),qw( +a b c d c e foo f)),2]}"' a b c x d c e foo f
the lowliest monk
|
---|