A program that loops using a pattern. : Loop « Regular Expression « Perl






A program that loops using a pattern.

   
#!/usr/local/bin/perl 

while ("balata" =~ /.a/g) { 
   $match = $&; 
   print ("$match\n"); 
} 

   
    
    
  








Related examples in the same category

1.Iterate over matches with foreach and $_ and nested foreach
2.Iterate over matches with foreach and $_ and nested while loop
3.Iterate over matches with while and $1
4.Zero width loop