in reply to Re: How does this code work? (from "Perl is Unix")
in thread How does this code work? (from "Perl is Unix")

Ohhhhhh. I see. Thank you for pointing that out! I've avoided using Prototypes in my own code, and had almost forgotten about them.

FWIW, I much prefer the more explicit syntax that you gave as an equivalent example. That is, something like this seems sensible and obvious to me:

#!/usr/bin/env perl use strict; use warnings; sub call_it { my $fn_ref = shift; &{$fn_ref}(); } call_it( sub { print "hi\n" } ); call_it( sub { print "bye\n" } );

Replies are listed 'Best First'.
Re^3: How does this code work? (from "Perl is Unix")
by Aristotle (Chancellor) on Nov 07, 2009 at 03:21 UTC

    If you understand map { foo($_) } then this code shouldn’t give you any trouble.

    Makeshifts last the longest.