#!/usr/bin/env perl

use locale;

my $file		= 'test.txt';
my $pushkin_small	= 'пушкин';
my $pushkin_normal	= 'Пушкин';

my $data		= LoadFile($file);

my $count_normal_i	= 0;
my $count_small_i	= 0;
my $count_normal      = 0;
my $count_small       = 0;

foreach my $line (@{$data}) {
	$count_normal_i++ if ($line =~ m/$pushkin_normal/isg);
	$count_small_i++ if ($line =~ m/$pushkin_small/isg);
	$count_normal++ if ($line =~ m/$pushkin_normal/sg);
        $count_small++ if ($line =~ m/$pushkin_small/sg);
}

print "Match small (RegEx with i flag): $count_small_i\n";
print "Match small (RegEx without i flag): $count_small\n";

print "Match for normal (RegEx with i flag): $count_normal_i\n";
print "Match for normal (RegEx without i flag): $count_normal\n\n";
TestCase($pushkin_small);
TestCase($pushkin_normal);

exit(0);


sub TestCase {
	my $string	= shift(@_);
	print "Case - Check for \'$string\'\n";
	print "lc() => ".lc($string)."\n";
	print "uc() => ".uc($string)."\n";
	print "lcfirst() => ".lcfirst($string)."\n";
	print "ucfirst() => ".ucfirst($string)."\n";
	
	print "\n";

	return 1;
}


sub LoadFile {
	my $file	= shift(@_);
	my @value	= ();
	open(FILE, "<$file");
	@value		= <FILE>;
	close(FILE);
	chomp(@value);
	return \@value;
}

