in reply to Remove ÿþ from a string

Hello AnishaM,

A quick search of turns up the module String::BOM which has a strip_bom_from_string function:

use strict; use warnings; use utf8; use String::BOM qw( strip_bom_from_string ); my $string = 'ÿþThe quick brown fox jumped over the unfortunate dog.'; print ">$string<\n"; $string = strip_bom_from_string($string); print ">$string<\n";

Output:

22:35 >perl 1697_SoPW.pl >ÿþThe quick brown fox jumped over the unfortunate dog.< >The quick brown fox jumped over the unfortunate dog.< 22:35 >

Note that this will remove the BOM from the beginning of the string only — which is the only place a BOM is supposed to occur within a text stream (see Byte order mark).

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,