in reply to A regex on the same content fails and works, with conditions

I suspect a line end or character encoding issue of some sort. Especially as you:

write_file($item_id, {binmode => ':raw' }, $html);

but then:

my $new_html = read_file($item_id);

Can you copy and paste the chunk that the regex is not matching and that you expect ought to, or at least the version that is matching? If it's publicly accessable, can you post an URL too?


Perl is environmentally friendly - it saves trees

Replies are listed 'Best First'.
Re^2: A regex on the same content fails and works, with conditions
by hacker (Priest) on Oct 22, 2007 at 01:59 UTC

    I added binmode, because I wanted to be sure the data coming off the socket was EXACTLY the same as what was expected.

    The regex fails in the first case, whether I use binmode or not, in write_file().