http://www.perlmonks.org?node_id=921178


in reply to Re^6: Creating hash with my imput
in thread Creating hash with my imput

Just replace exit with last and it should work the way you want it to, ie: if ($in =~ /exit/i){ last }