Hi Dominic,
* Dominic Dunlop <shouldbedomo mac.com> [2007-10-05
17:00]:
> On 2007–10–05, at 16:43, H.Merijn Brand wrote:
>
>> You made it too ugly imho
>>
>> - print join(':', split(/ */, 'hi there'));
>> + print(join(':', split(/ */, 'hi there')),
"n");
>> * print join(':', split(/ */, 'hi there'),
"n");
>
> But that produces slightly different output:
>
> $ perl
> print join(':', split(/ */, 'hi there'),
"n");
> h:i:t:h:e:r:e:
> $ perl
> print(join(':', split(/ */, 'hi there')),
"n");
> h:i:t:h:e:r:e
FWIW I always write this sort of thing as
print join( ... ) . "n"
instead. No subtleties to remember. I also generally omit
parens
on `split`, so that’d be
print join(':', split / */, 'hi there') .
"n";
Much easier to read off, IMO.
--
*AUTOLOAD=*_;sub
_{s/(.*)::(.*)/print$2,(",$/","
")[defined wantarray]/e;$1}
&Just->another->Perl->hack;
#Aristotle
|