
sub trim($){
  $_ = shift;
  s/^\s*//;
  s/\s*$//;
  return $_;
}

    print "OOOO :)";
    print "\n Sisesta taht: ";
    $temp1=<STDIN>;#sisend, loppeb enteriga
    $otsi =trim(uc($temp1));#uc=upper Case
    print "\n";
    open(SISU, "<tekst.txt");#avab faili

    while (<SISU>)  {

	for $i (split / /) {#poolitab  tyhiku koha pealt

	    if (length($i)>0){

		$sona = trim(uc($i));
                if($otsi eq substr($sona, 0, 1)){
                    $arv++;
                }
 		$tekst = $tekst." ".$i;
	    }
	}
    }    

    close(SISU);

    print $tekst;
    print "\n\n\n So~nu mis algavad ta*hega $temp1 on kokku $arv";
    
    