in reply to Regex During Map Function

Yes, u've hit the age old problem of s/// not returning the bound value but the substitution count. To get the value returned in place use this little hack:
($var =~ s/foo/bar/ ? $var : $var)
This way the post op value of $var will always be returned. HTH.

Replies are listed 'Best First'.
Re^2: Regex During Map Function
by bart (Canon) on Dec 16, 2010 at 20:44 UTC
    Use do to use a block containing several statements in an expression:
    do { s/foo/bar/; $_ }
    Although, once you're using map, you don't need do: just use the block. And no comma.
Re^2: Regex During Map Function
by deMize (Monk) on Dec 15, 2010 at 22:03 UTC
    That's true, but it'd require declaring the $var before the map. I was hoping to do it without the additional variable declaration outside the map function. It'd probably be more efficient to do it outside, though. The real hope was to apply it to the join result, rather than creating a variable at all.

    Thank you


    Demize