in reply to Re: Re: Re: Golf: string complement
in thread Golf: string complement

@_ hack?

I suppose, though it's expected behavior. Within the RE @_ is interpolated just like "@array\n" would be. Since @_ should only have one argument, there will be only one element in the list. Thus, there is no extra space character interpolated. If @_ contained more than one element, that would result in a space character being placed in the character class, which would cause the space character to be absent from the inverted string even if the original string never had a space in it. ...so it's easy to break this solution, but assuming the sub is called as intended, it will only have one arg, and the point will be moot.

I guess it is a hack. ;)


Dave

  • Comment on Re: Re: Re: Re: Golf: string complement