#!/usr/bin/perl use strict; # always do this! use warnings; # always do this! use Switch; my $i; # we declare it, but never assign it. chomp(my $var = ); switch ($var) { case(1) { test_func() } } print "case: $i\n"; # perl complains..$i is not assigned sub test_func { print "\nhello"; }