#!/usr/bin/perl while ($lines = <>) { chomp ($lines); (undef, $symbols, $weights) = split /,/, $lines; $weights{$key} = $weights; } print "Please enter a Chemical Formula: "; chomp ($formula = <>); @array = $formula =~ /[A-Z][a-z]?|\d+/g; sub mol_form { }