Help for this page

Select Code to Download


  1. or download this
    my $line = "One two three four five";
    if (my @captures = $line =~ m/(one)\s(two)\s(three)\s(four)\s(five)/i)
    + {
       $captures[0] =~ s/one/ONE/i;
       print "$_: $captures[$_-1]\n" for 1..5;
    }
    
  2. or download this
    my $line = "One two three four five";
    if (my @captures = split(' ', $line)) {
       $captures[0] = uc($captures[0]);
       print "$_: $captures[$_-1]\n" for 1..5;
    }