how to get the pos() of 2 str matches in one loop in perl

Hello all
i have this simple loop that gets me every time the match of "<#" in my string
something like that :

my $str ="gggg<#nnnnn#>kkkk<#ssss#>llllll";
while($str =~m/<#/g){
print pos($str);
}

but now i like to get another pos in the same loop iteration , i will like to get the match of "#>"
can it be done in perl ?

What about

my $str ="gggg<#nnnnn#>kkkk<#ssss#>llllll";
 while($str =~m/(<#|#>)/g){
 print pos($str);
 }