1
2
3
echo 'ax&bx&cx&dx' | PERL5OPT='w M5.10.1' perl -ne 'say "$1$2" if /(a[^&]*).*?(&c[^&]*)?.*/'
Use of uninitialized value $2 in concatenation (.) or string at -e line 1, <> line 1.
ax
echo 'ax&bx&xx&dx' | perl -wnE 'say "$1$2" if /(a[^&]*)(?:.*?(&c[^&]*))?/'