Thread Probleme mit anonymen subs
(13 answers)
Opened by Ronnie at 2005-03-10 09:25
spassiger wirds wenn du alles in eine sub packst:
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 my $substitute= sub { $_; }; for (<DATA>) { chomp; my ($k, $v) = split(/ -- /); print "adding correction for [$k]\n"; $substitute= sub { my $r= shift; sub { s/^$k/$v/ or $r->() } }->( $substitute ); } while(<>) { chomp; $substitute->(); print $_, $/; } -- stefan
|