advanced code snippet search
johngh on 11/24/09
closure perl
11/24/09 07:43am
#!/usr/bin/perl -w###use strict; my $x = 12;{ my $x; sub inc { $x++; print "$x\n" } sub dec { $x-- ; print "$x\n"} } inc();inc();inc();inc();dec();inc(); print "$x\n";
Report this snippet Tweet
Comment:
You need to login to post a comment.