From: Kev <[EMAIL PROTECTED]>
> Hi everyone,
>
> I'm having a problem that may either lie in PostgreSQL or in perl, and
> I'm not sure which. I originally posted this on pgsql.general, and
> only heard back that someone else has this problem too. I'm running
> perl 5.10 on Windows 2003 Server, although I believe the version
> embedded in pgsql at the moment is still 5.8.
>
> The basic problem is that I generate the code of a function, and then
> want to check whether this is the same code stored in the database or
> not, but diff shows "differences" where there aren't any (or shouldn't
> be any, since nothing in the database has changed), and worse, perl's
> 'eq' and 'ne' operators agree with diff that the strings are
> different. But at least visually the two texts being compared are
> identical, and if I copy and paste the results from Firefox into
> TextPad and then run "compare files", it says they're identical.
Run the two strings through
sub nicehex {
my $s = $_[0];
my $hex = unpack 'H*', $s;
$s =~ tr/\x00-\x0A/./;
$hex =~ s/(..)/$1 /g;
my @hex = ($hex =~ /(.{47}) /g);
my @s = ($s =~ /(.{16})/g);
my $res = '';
while (@s) {
$res .= shift(@hex) . ' |' .shift(@s) . "\n";
}
return $res;
}
and compare (visualy) the results. Maybe some spaces are tabs or vice
versa. See what are the different characters.
Space: 20
Tab: 09
CR: 0d
LF: 0a
Nonbreakable space: a0
HTH, Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/