> > >         my $newfile = "$str.subst(rx|\.\w+$|, '')\.bin";
> 
>    But what about the value of $str after interpolation?
> In shall it stays it's original value! I would often need,
> to use a little modified value of $str for a particular expression.
> I like the way shell does it, to be able to write it such short,
> without any other explicit variable.

Yeah, the fact that substitutions were only destructive in Perl 5 was a
major kludge.  I was taking the .subst method there as a functional,
non modifying version.  So:

    $str.subst(...)  # returns substituted string, leaves $str alone
    $str.=subst(...) # modifies $str

Luke

Reply via email to