#!/usr/bin/perl use warnings; use strict; my %hash = (one => 1, two => 2, three => 3, four => 4, five => 5); if (%hash) { print scalar(%hash); # produces '4/8' }