in reply to subroutine help
A few things to help you out:
#!/usr/bin/env perl use strict; use warnings; use feature 'say'; use Data::Printer; print "Enter a chemical formula: "; chomp( my $form = <> ); my %weight = $form =~ /[A-Z][a-z]?|\d+/ig; p %weight; __END__ Enter a chemical formula: C12H22O11 { C 12, H 22, O 11 }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: subroutine help
by perlguru22 (Acolyte) on Nov 29, 2012 at 08:04 UTC | |
by frozenwithjoy (Priest) on Nov 29, 2012 at 08:12 UTC |