#!/usr/bin/perl use strict; use warnings; sub countdown_iterator { my $start = shift; return sub { $start-- }; } my $countdown = countdown_iterator( 10 ); while ( my $time = $countdown->() ) { print "T - $time\n"; } print "Blast off\n";
Cheers - L~R
In reply to Re: Anonymous Subroutines
by Limbic~Region
in thread Anonymous Subroutines
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |