in reply to Declaring a code ref with arguments
#!/usr/bin/perl -w use strict; sub print_me { my $arg = shift || "Hello World!\n"; print $arg; } my %hash = (no_arg => sub { &print_me()}, with_arg => sub {&print_me("Hello again!\n")} ); $hash{no_arg}->(); $hash{with_arg}->();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Declaring a code ref with arguments
by !unlike (Beadle) on Aug 05, 2003 at 09:35 UTC | |
|
Re: Re: Declaring a code ref with arguments
by cfreak (Chaplain) on Aug 05, 2003 at 13:35 UTC | |
by cianoz (Friar) on Aug 05, 2003 at 14:55 UTC |