in reply to Re: Re: Re: Scoping issues with code evaluation asserstions?
in thread Scoping issues with code evaluation asserstions?
I have this clever idea to have the function use its own name as the slot for the return value.
sub regex { my $in = shift; # Assign something to $ret in a code assertion my $function = (caller 0)[3]; no strict 'refs'; $$function = ''; $in =~ m/^(a)(?{ $$function = 1})/; return $$function; } while(<DATA>) { print regex($_) . "."; } __DATA__ a b a abcd bcda
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: Re: Re: Scoping issues with code evaluation asserstions?
by sauoq (Abbot) on Jun 19, 2003 at 19:34 UTC |
In Section
Seekers of Perl Wisdom