in reply to Converting a hash element into an array

Entering 4 pairs this way is uncomfortable and error prone (forget to enter one item or press return twice and you have keys and values switched). If (for example) '=' can't occur in any key, entering them as 'key = value' might be better:

my $all = <STDIN>; chomp($all); if ($all=~/([^=]+?)\s*=\s*(.*)/) { $hash{$1} = $2; } else { print "Input Error. \n"; $i--; }