Subject: | suggest way to skip some lines |
Date: | Mon, 08 Jan 2018 17:54:45 +1100 |
To: | bug-Search-Dict [...] rt.cpan.org |
From: | Kevin Ryde <user42_kevin [...] yahoo.com.au> |
As an idea for a feature, it could be good if Search::Dict had a way to
ignore some unwanted lines when it searches.
I thought to use it on some OEIS "B-files" which have lines like
# some comment
1 838
2 4378
3 547894
4 8429138492
where want to ignore "#" comments (and perhaps blank lines at end of
file, though that should be abnormal).
I used an "xfrm" to get the first number as key, and thought perhaps
return undef from it could mean an unwanted line. I'd have in mind
look() simply reading (and xfrm-ing etc) next line until a wanted one.
A predicate func or a regexp of wanted or unwanted could also suit.
Even a readline func parameter which could do various strange reading.
A tied handle could have a special readline I imagine, but a func
parameter may be easier than a class .. and can have more than one way
to do it eh ... :)