How to read in ISO 8859-1 (Latin-1) encoded text in Perl

So I'm trying to write a perl script to read in a file encoded in Latin-1. For some reason, this just isn't working out. When I try to do a simple search for a character that I know is in the file (it's in the first line), nothing shows up. I'm using use encoding "iso 8859-1"; below, but I've also tried binmode(STDIN, ":utf8");. Any suggestions on what I might be doing wrong, and how to make it right?

use encoding "iso 8859-1";

while(<>)
{
    if(/ó/gi)
    {
    print "Found one!\n";
    }
}
7
задан John Montgomery 19 November 2010 в 01:19
поделиться