Today I wrote some perl5 code for the umpteenth time. Basically:

  for( my $i=0; $i< $#ARGV; $i++ )
  {
     next unless $ARGV[$i] eq "-f";
     $i++;
     $ARGV[$i] = absolute_filename $ARGV[$i];
  }
  chdir "foo";
  exec "bar", @ARGV;

I'm trying to work out if there's a clever perl6 way to write this using pattern matching:

  for @*ARGV -> "-f", $filename {
    $filename .= absolute_filename;
  }

Would this actually work, or would it stop at the first elem that doesn't match ("-f", ::Item)?

Is there some way to associate alternate codeblocks for different patterns (i.e. local anonymous MMD)?


Dave.


(ps. if anyone on this list is looking for a $perl_job in Santa Clara, CA, please contact me by email: dwhipp at nvidia -- no promises, but we might even pay you to work on p6)

Reply via email to