So if the User enters like C12H22O11 when I print at array it shows C 12 H 22 O 11 but when I print or return @weight it goes back to C12H222O11 its no longer seperated do I need to do the reg expression inside the routine too? Thanks I hope someone can show me the right wayprint " enter a formula.\n"; chomp($form=<>); @array = $form =~ /[A-Z][a-z]?|\d+/ig $weight = getweight(@array); sub getweight { my @weight =@_; }
In reply to subroutine help by perlguru22
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |