That can delete too many lines.
01 keep 02 keep <- gets discarded by your code. 03 keep <- gets discarded by your code. 04 keep <- gets discarded by your code. 05 keep <- gets discarded by your code. 06 keep <- gets discarded by your code. 07 discard B5 08 discard B4 09 discard B3 10 discard B2 11 discard B1 12 somepat 13 somepat
That's in addition to the problems with $.-5 going negative.
By the way, splice would be more efficient than delete since it wouldn't shrink the allocated buffer.
I'm also trying to get the (-d) to be a stand-alone flag. What would be the best approach to this?
'd!' => \$delete,
-c ./someconfile
That's weird. Why not just print to STDOUT and redirect output? It's way more flexible at no cost.
perl dellines.pl -i somepat -d > someconfile
The name of the option doesn't even make sense. It's an output file, not a config file as far as the tool is concerned.
In reply to Re^3: Regex question
by ikegami
in thread Regex question
by jamsda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |