fork(3) download
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4.  
  5. my $s = 'function (foo, bar, some, other) {';
  6. $s =~ s/(?:\G(?!\A),?|function\s*\()\s*\K(\w+)/$1:any/g;
  7. print $s;
Success #stdin #stdout 0s 18256KB
stdin
Standard input is empty
stdout
function (foo:any, bar:any, some:any, other:any) {