in reply to Re: Is silent use of $_ for empty argument lists reasonable for "shortcut" functions?
in thread Is silent use of $_ for empty argument lists reasonable for "shortcut" functions?

No, the "shortcut" idiom modifies its arguments in place if called in void context. I only want to disconnect aliasing if the function is called in a non-void context.

That way the function will return value(s) when asked or operate on it's arguments in place when called appropriately. Eg:
@strs = ( " a string ", " b string "); $s = " my string "; $a = trim($s); # $a gets the trimmed version of $s @b = trim(@strs); # @b gets trimmed versions of all strings in @strs trim($s); # trim $s in-place trim(@strs); # trim all @str in-place
- Wyrd
  • Comment on Re^2: Is silent use of $_ for empty argument lists reasonable for "shortcut" functions?
  • Download Code