in reply to Re^2: list reversal closure
in thread list reversal closure
So how about this as an alternative?:
#!/usr/bin/perl -l sub revlist { my @list = @_; sub { pop @list }; } my $foo = revlist(@ARGV); print while local $_ = $foo->();
Edit: Optionally, closure subroutine might look like this, of course:
sub { return unless @list; pop @list; };
|
- apotheon
CopyWrite Chad Perrin |
|
|---|