<?xml version="1.0" encoding="windows-1252"?>
<node id="1006165" title="subroutine help" created="2012-11-29 01:26:29" updated="2012-11-29 01:26:29">
<type id="115">
perlquestion</type>
<author id="995027">
perlguru22</author>
<data>
<field name="doctext">
I am having some problems passing my array to my subroutine.

&lt;code&gt;

print " enter a formula.\n";
chomp($form=&lt;&gt;);

@array = $form =~ /[A-Z][a-z]?|\d+/ig

$weight = getweight(@array);

sub getweight
    {
       my @weight =@_;
     }

&lt;/code&gt;

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 way 
</field>
</data>
</node>
