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 }
In reply to Re: subroutine help
by frozenwithjoy
in thread subroutine help
by perlguru22
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |