when i copy and paste text from a webpage to a txt file and have perl open it, i get these strange boxes where there should be spaces. how do i use perl to replace them?

Recommended Answers

All 7 Replies

i've tried $str =~ s/\?/ /g;

Hi Wade_1,

How are you reading the text file from with your Perl script?

What are the text copied into the text file? Obviously, these will be a UTF8 charater set issue.

Moreover, you don't need to copy from a webpage into a text file, before opening and reading the text file with a Perl Script. You can read straight using perl module like LWP::Simple and others.

We might be able to help if you could give more details of your data, and expected data.

Thanks

I have my cgi and perl files at TRIPOD.com and they don't allow LWP::
so i copy the webpage source (what i thought was wordpad) and paste it to a text file to use the data.

try this:

$str =~ s/[^a-z]/ /ig;

Hope it helps

that got rid of those boxes for me - now i just need to keep numbers also.

SOLVED - thanks so much for putting me on the right track 2Teez!

Wade_1,

Nice one. Please, Mark the question solved.

Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.