in reply to Substitution Loop

I've run into the same kind of thing, but it seems size-related in my case. I'm munging through several overly large (1-2GB) PST and MDB files, trying to do plaintext searches. When I do some pre-emptive cleanup, I get the error; I'm sure there's a better way to do this, but...
local $/ ; open FILE, $file ; my $data = <FILE> ; #yes, I have enough memory close FILE ; $data =~ s/[^[:ascii:]]+//g ; while ($data =~ /($regex)/g) { ... }
Any MS Office files under the 1GB mark seem to happily go through the cleanup - others die miserably with the [seemingly] unrecoverable "Substitution loop in..." error.
v5.8.8 built for x86_64-linux-thread-multi

Replies are listed 'Best First'.
Re^2: Substitution Loop
by Anonymous Monk on Jan 09, 2014 at 15:31 UTC
    Ditto. This seems like perl must keep a loop counter on substitutions to detect the error, because I'm doing this on a 1.5GB file, and it errors. Split that in half, and it passes (doing this on 64-bit perl for memory needs). cat the first half back onto itself (to make sure it is just duplicate of the first and not a source of the error) to get it back up to 1.5GB, fails. -JM