in reply to Strange Observation [SOLVED]

Hello karlgoethebier,

The problem is that Perl doesn’t recognise zip as a subroutine when it parses the line in question. As toolic says, one way to solve this is to make the subroutine call unambiguous by removing the whitespace between the subroutine name and the opening parenthesis of the argument list.

Another way is to provide a forward declaration:

use warnings; use strict; use feature qw(say); sub zip; say zip 'ABCDEFGHIJ', 'abcde'; sub zip { join "", sort { lc $a cmp lc $b} split "", $_[0] . $_[1]; }

Output:

23:44 >perl 1303_SoPW.pl AaBbCcDdEeFGHIJ 23:45 >

This is documented in the Camel Book (4th Edition, 2012, p. 960):

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,