Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Wah, this is clever... I'd never have thought of that! Well, I will, in the future! ;-) (n.b. you need to add the /g modifier)
BTW, there's a syntax for tr that serves to just count occurrences, without changing anything. Just leave the RHS empty, which is like replacing characters by themselves while counting, but which is optimizined to skip the replacing.
You still need to cater for the abnormal case where the file contains an odd number of quotes, thus, check for eof. Update Judging by the tests I've done, the next snippet will work excellently for reading and processing data from <>, and includes processing for the final record for each file, even if incomplete:
In reply to Re^2: Conditional continued matching with regexes
by bart
|
|