sub parsevcard { my ($inputstr, $inputpos) = @_; my $currentcard = {}; # Parse current vCard starting at $inputpos position in $inputstr string.. # enter values in $currentcard hashref if($inputstr =~ /\GBEGIN:VCARD/) { # We found another vcard, set $pos to beginnnig of new card, and call ourselves again.. $currentcard->{AGENT} = parsevcard($inputstr, $pos); } return $currentcard; }