+ return i;
+}
+
+STATIC int indirect_find(pTHX_ SV *name_sv, const char *line_bufptr, STRLEN *name_pos) {
+#define indirect_find(NSV, LBP, NP) indirect_find(aTHX_ (NSV), (LBP), (NP))
+ STRLEN name_len, line_len;
+ const char *name, *p, *t, *u;
+
+ name = SvPV_const(name_sv, name_len);
+ if (name_len >= 1 && *name == '$') {
+ ++name;
+ --name_len;
+ line_bufptr = strchr(line_bufptr, '$');
+ if (!line_bufptr)
+ return 0;
+ }
+
+ p = line_bufptr;
+ while (1) {
+ p = strstr(p, name);
+ if (!p)
+ return 0;
+ if (!isALNUM(p[name_len]))
+ break;
+ /* p points to a word that has name as prefix, skip the rest of the word */
+ p += name_len + 1;
+ while (isALNUM(*p))
+ ++p;
+ }
+
+ t = SvPV_const(PL_linestr, line_len);
+ u = t;
+ while (t <= p) {
+ STRLEN i = indirect_nextline(t, line_len);
+ if (i >= line_len)