On Mon, Dec 24, 2001 at 12:30:36AM -0800, Paul Makepeace wrote:

> Adding a dummy sub greet {} illicits the predictable "subroutine
> redefined" warning. Thus,
> 
> sub greet {}
> { no warnings;
> *main::greet = sub { print "Hello ", shift };
> }
> greet "world";
> 
> Is there some way to avoid these contortions, aside from acceding to the
> paren monster?

gamma:/tmp $ cat greet
#!/usr/bin/perl -w

sub greet;      # pre-declare, don't pre-define

*main::greet = sub { print "Hello ", shift };
greet "world";

gamma:/tmp $ perl greet
Hello worldgamma:/tmp $
 
Or am I missing something??  (I thought you mentioned prototypes somewhere?).
-- 
Chris Benson

Reply via email to