in reply to Re: Simple way to skip spaces and # comments
in thread Simple way to skip spaces and # comments
/\G (?: \s++ | \# .*+ )++ /xgc
^^^^ This makes error about recursion limit...
# for f in `seq 40123`; do echo " #alfa beta"; done | perl -e 'use str +ict; use warnings; undef $/; my $s = <STDIN>; print length $s, "\n"; +$s =~ /\G (?: \s++ | \# .*+ )++ /xgc; print pos $s, "\n"; ' 481476 Complex regular subexpression recursion limit (32766) exceeded at -e l +ine 1, <STDIN> chunk 1. 196597
In Section
Seekers of Perl Wisdom