in reply to Why do I get a "used only once" warning here?
use warning; use strict; { my %log_seen; sub log_info { # do not continue if done before return if $log_seen{(caller(1))[3]}++; warn(@_, "\n"); } } sub f { log_info('some information'); print "called f()\n"; } f(); f(); __END__ some information called f() called f()
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why do I get a "used only once" warning here?
by rovf (Priest) on Mar 16, 2009 at 08:55 UTC | |
by repellent (Priest) on Mar 16, 2009 at 16:01 UTC | |
by rovf (Priest) on Mar 16, 2009 at 17:45 UTC |