[Israel.pm] hebrew range

Yuval Kogman nothingmuch at woobling.org
Sun Oct 7 08:17:57 PDT 2007


On Sun, Oct 07, 2007 at 14:11:33 +0200, Ernst, Yehuda wrote:
> Hello!
> 
> I want to use range like 
> 
> 
> [a-z]
> 
> but in Hebrew from [א-ת]
> 
> How do i do it in perl?


#!/usr/bin/perl

use strict;
use warnings;

use utf8; # this is the important bit, it lets the א-ת be
interpreted as
# unicode characters, and makes sure the strings in the qw() are
# also unicode

binmode STDOUT, ":utf8"; # to prevent the wide character in print
warning

foreach my $string qw(שלום hello) {
	print "string matches: $string\n" if $string =~ /[א-ת]/;
}

string matches: שלום

-- 
  Yuval Kogman <nothingmuch at woobling.org>
http://nothingmuch.woobling.org  0xEBD27418




More information about the Perl mailing list