use strict; my $str = sub { "params.$_[0].arg" }; sub do_something { print +shift, "\n" } for my $idx (0..10) { do_something( $str->($idx) ); }